Skip to content

Instantly share code, notes, and snippets.

@youcoldfusion
youcoldfusion / testxml.xml.cfm
Last active December 15, 2015 16:39
xml parsing in coldfusion
<?xml version="1.0" encoding="UTF-8"?>
<employee>
<!-- A list of employees -->
<name EmpType="Regular">
<first>Animesh </first>
<last>Dutta</last>
</name>
<name EmpType="Contract">
<first>Hiranmayee</first>
<last>Dutta</last>
@youcoldfusion
youcoldfusion / callwebservice.cfm
Created April 2, 2013 14:24
ColdFusion Webservice
<!---
<cfinvoke component="testWebservice" method="getUser" returnvariable="display">
<cfinvokeargument name="username" value="Animesh Dutta">
</cfinvoke>
<cfdump var="#display#">
--->
<!---<cfinvoke method="getUser" webservice="http://YOURURL/testWebservice.cfc?wsdl" returnvariable="display">
<cfinvokeargument name="username" value="Animesh Dutta">
</cfinvoke>--->
<cfset ws=createObject("webservice","http://YOURURL/testWebservice.cfc?wsdl")>
<cfcache timespan="#createTimeSpan(0,0,10,0)#" action="clientcache" >
This page show cfcaching <br/>
<cfoutput>
This page was generated at #now()#<br>
</cfoutput>
<cfparam name = "URL.x" default = "no URL parm passed">
<cfoutput>The value of URL.x = # URL.x #</cfoutput>
@youcoldfusion
youcoldfusion / structure1.cfm
Created April 3, 2013 13:15
working with ColdFusion Structure
<cfset newStructure={}>
<cfset newStructure.id=1>
<cfset newStructure.name="ColdFusion">
<cfdump var="#structkeyexists(newStructure,"hi")#">
<cfdump var="#isdefined("newStructure.id")#">
<cfdump var="#structdelete(newStructure,"name")#">
<cfdump var="#newStructure#">
<cfset newStructure.version=8>
<cfdump var="#newStructure#">
<cfdump var="#structclear(newStructure)#">
@youcoldfusion
youcoldfusion / cfloop.cfm
Created April 3, 2013 13:21
Looping over structure in coldfusion
<cfset newStructure={}>
<cfset newStructure.id=1>
<cfset newStructure.name="ColdFusion">
<cfloop collection="#newStructure#" item="key">
<cfoutput>#key#</cfoutput>
<cfoutput>#newStructure[key]#</cfoutput><br/>
</cfloop>
@youcoldfusion
youcoldfusion / aform.cfm
Last active December 15, 2015 18:09
Working with ColdFusion cffile
<!--- We should use div's-:<div></div> instead of table --->
<html>
<head>
<title> Employee Details</title>
</head>
<body>
<h2>Employee Details</h2>
<table>
@youcoldfusion
youcoldfusion / contentDownload.cfm
Created April 5, 2013 10:28
<cfdirectory>,<cfcontent>,<cfheader>
<!--- It will download the file what we click--->
<cfcontent type="text/html" >
<cfheader name="Content-Disposition" value="attachment;filename=#url.name#" >
<cffile action="read" file="PATHTOTHEFOLDER\#url.name#" variable="displayFileContent" >
<cfoutput>#displayFileContent#</cfoutput>
@youcoldfusion
youcoldfusion / cflayout.cfm
Created April 5, 2013 13:32
<cflayout>,<cflayoutarea>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<cflayout type="tab" name="thelayout" tabheight="175" style="background-color:silver;color:black; height:200">
<cflayoutarea title="Tab 1" style="border:1px solid black" closable="false" >
This is text in layout area 1
</cflayoutarea>
<cflayoutarea name="area2" title="Tab 2" inithide="false" style="border:1px solid black" >
@youcoldfusion
youcoldfusion / cfdocument1.cfm
Last active December 15, 2015 21:19
<cfdocument>
<cfdocument format="PDF">
<table border="1" cellspacing="0" cellpadding="0">
<tr>
<td>Name</td>
<td>Years Of Experince</td>
<td>Current Location</td>
<td>Main Skill</td>
</tr>
<tr>
<td>Animesh Dutta</td>
@youcoldfusion
youcoldfusion / cfdocument.cfm
Created April 6, 2013 08:26
cfdocument in ColdFusion
<!--- The Password for opening the account is dutta--->
<cfdocument format="pdf" encryption=" 128-bit" userPassword="dutta">
<!--- Header of the pdf document --->
<cfdocumentitem type="header">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="right">
<cfoutput>#cfdocument.currentsectionpagenumber# of #cfdocument.totalsectionpagecount#</cfoutput>
</td>
</tr>