Login
Latest Code Ticker for ColdFusion
|
Daily Code Email
|
|
|
|
| | Terms of Agreement:
By using this article, you agree to the following terms...
1) You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for langauges that allow it) freely and with no charge.
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description. | New ColdFusion 5.0 Feature Highlights
by Herbert L. Riede
Programmer, WinDough.com, Inc.
This article was updated May 6th with an updated UDF demo for cross-browser compatibility
CFFLUSH
This new tag enables you to "Flush" what a ColdFusion page has generated so far to the browser. Currently, HTML Output is not sent to the visitor's browser until the entire page has been processed. This tag enables you to output the top of the page or a small "Page Loading" message while the rest is processed. You _cannot_ use any tags that alter the HTTP header once you Flush.. It will throw a CFError. No CFLocation's after a Flush!!
Link to Allaire's (-ahem- Macromedia's) Description
Query of Queries
This new feature enables you to run a query on a recordset already returned from a query, without hitting the database again. It can also be used to perform SQL queries against <CFDIRECTORY> listings, as well as on information returned by other tags as a recordset.
Link to Allaire's (-ahem- Macromedia's) Description
User Defined Functions (UDFs)
This is a new CFScript feature (but you can use the functions you write in cftags or #function(var)# formats)
A simple demonstration would be a function that creates roll-over code for you:
<cfoutput>
#RollOver("MyImg", "myimg.gif", "myrollover.gif",
"http://mysite.com")#
</cfoutput>
<cfscript>
function RollOver( name, img, imgover) {
HTMLOut = "<a href='";
if (ArrayLen(Arguments) eq 4) {
HTMLOut = "#HTMLOut##Arguments[4]#'";
} else {
HTMLOut = "#HTMLOut####name#' name='#name#'";
}
HTMLOut = "#HTMLOut# onmouseover='#name#.src = ""#imgover#"";' onmouseout='#name#.src = ""#img#"";'><img src='#img#' name='#name#' border=0></a>";
return HTMLOut;
}
</cfscript>
This works in CF5 and outputs:
<a href='http://mysite.com' onmouseover='MyImg.src = "myrollover.gif";' onmouseout='MyImg.src = "myimg.gif";'><img src='myimg.gif'
name='MyImg' border=0></a>
Note I only declared 3 arguments in RollOver. This enables you to call it with only 3 arguments for No-Link Rollovers. The fourth argument, if it exists, is the URL to link to. IF I HAD DECLARED ALL FOUR, ALL FOUR WOULD HAVE BEEN REQUIRED.. So this is an example of optional arguments as well..
Also note that I COULD do this with a custom tag, but a collection of these short functions all in one file could be a POWERFUL include file.. Include a function library in your application.cfm and you will have built your own language extensions!
Link to Allaire's (-ahem- Macromedia's) Description
CFSAVECONTENT
This new tag takes ColdFusion to a whole new level. Just wrap CFSaveContent around, well, anything and do anything with it. Similar to having a custom tag process "ThisTag.GeneratedContent" (If you don't know what I'm talking about, don't worry), but this "offers significant performance improvements over custom tag solutions." (MacroMedia ColdFusion 5 Beta Site)
Link to Allaire's (-ahem- Macromedia's) Description
CFGRAPH
A new Multimedia tag, CFGRAPH outputs GIF, JPG, and FLASH graphs and charts - in Pie, Line, and Bar format. There is SO MUCH ABOUT THIS TAG, You need to visit their site to learn all about it!
Link to Allaire's (-ahem- Macromedia's) Description
I plan on writing CF5 Function Libraries, Graph examples and more in the near future. I think these New Features will have me working late to take advantadge of all the new possibilities.
I invite your comments, and any questions you may have. If this tutorial was valuable to you, please vote!
| | |
|