News by ColdFusion Cookbook

This feed does not validate. (details)

How do I return XML from a CFC that can be used with Spry?

6 Mar 00:58
There are a few things to look out for when returning XML to Spry. Make sure you set output=false for both the component and the method to suppress any whitespace that may be included with the returned XML. Also note the <cfcontent> tag directly before returning the XML. This is not needed for returning XML to other consumers such as Flex, but without it, Spry will not recognize it as valid XML. Special thanks to Bruce Phillips for pointing this out. Below is a sample components with 1...

How do I programmatically create a new datasource?

15 Feb 22:55
The short answer is to use the Coldfusion Administrator API. The following is taken directly from the ColdFusion documentation: You can perform most ColdFusion MX Administrator tasks programmatically using the Administrator API. The Administrator API consists of a set of ColdFusion components (CFCs) that contain methods you call to perform Administrator tasks. For example, you use the setMSQL method of datasource.cfc to add a SQL Server data source. // Login is a...

How can I pass alt tag (or other attributes) to the cfinput tag?

30 Jan 11:43
The cfinput tag allows you to pass any attribute. If the attribute is not one of the attributes specifically designed for the cfinput tag, the attribute and value will be rendered with the form element tag. As an example, you can use the ALT attribute in a cfinput tag for Section 508 (Accessibility) compliance.

How do I convert a list of files into links?

22 Jan 10:26
ColdFusion makes it easy to dynamically list out the files in a folder. Converting this list of files into a list of hyperlinks is pretty simple. This will only work if the folder is under your web root (or available as a virtual folder on your web server). First decide on the folder you will list: Next you need to loop over the files and output them. The link will be based on the folder and how it relates to your web s...

How do I connect to a Progress Database

8 Jan 21:53
To connect to a Progress 9.1 Database you first need to licensed copy of the Progress Client. Once the client is installed add the Progress classes file path into the MX7 Jrun instance. If using a developer CFMX make this change to the settings under cfusion. Add a New Classpath example: C:\Program Files\PROGRESS\java; Restart CF instance. Search the System Information page to locate the following files in CF Admin C:\Program Files\PROGRESS\java\jdbc.jar; ...

How do I migrate from Application.cfm to Application.cfc?

27 Dec 00:20
One of the best new features of ColdFusion 7 is the Application.cfc file. This allows for much more control over the ColdFusion application. In general the process involves migrating settings (for example, enabling client and session management) and code that would handle various events. First lets look at settings. This <cfapplication> tag represents something you might have used in an Application.cfm file:

How can I tell the dimensions of an image in ColdFusion?

26 Dec 23:54
ColdFusion does not have native image support (i.e., the ability to manipulate images) although it has been confirmed for the next version. However, there are multiple products that add this capability to ColdFusion. For this entry, we will look at ImageCFC, a free and open source solution created by Rick Root. This component provides multiple image manipulation options. To simply check the size of an image, you can use this code:

How Do I Send An Email To Multiple Recipients Without All Email Addresses Being Listed in the To Line?

21 Dec 05:46
Use the query attribute of the <cfmail> tag. Doing this will iterate once over the cfmail tag for each row in the query. You must specify the query column that contains the appropriate email address in the to attribute of cfmail. SELECT emailAddress FROM tblUsers

How do I remove repeated values from a list?

12 Dec 23:57
The ListDeleteDuplicates(list) UDF found on cflib is a great example of how to accomplish this task. The UDF works by creating a copy of the list. Before it adds an item to the new list, it checks to see if it doesn't already exist. /** * Case-sensitive function for removing duplicate entries in a list. * Based on dedupe by Raymond Camden * * @param list The list to be modified. * @return Returns a list. * @author Jeff...

How can I create page navigation that dynamically highlights the current page?

24 Nov 23:26
When displaying navigation to the user, it is a good idea to highlight the current page or section that user is currently viewing. This makes it easier for the user to see where they are in the site. There are a couple of ways this can be done, but here is a simple example. First, consider this simple menu: Home About Us Products Press Releases By looking at CGI...
Pages   ← previous   next
1 2 3 4 5