2008 East
DIAMOND SPONSOR:
Data Direct
Frontiers in Data Access: The Coming Wave in Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
Intel
Virtualization – Path to Predictive Enterprise
Green Hills
IT Security in a Hostile World
JBoss / freedom oss
Practical SOA Approach
GOLD SPONSORS:
Software AG
The Art & Science of SOA: How Governance Enables Adoption
PlateSpin
Effective Planning for Virtual Infrastructure Growth
Fujitsu
Automated Business Process Discovery & Virtualization Service
Ceedo
Workspace Virtualization
Click For 2007 West
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
In today's cooking class you'll add to your cookbo...
BLOG-N-PLAY.COM
Is White Listing going Mainstream?
CFDJ TOP LINKS YOU MUST CLICK ON !


The Secret Powers of Includes
You've probably been told for years that CFINCLUDE is like a compile-time directive that 'pulls code' from another file into your template for reuse. That's wrong. I'll prove it to you. Indeed, have you ever tried to include something other than a CF template? You can. Wonder what including a text or XML file might do?
Reader Feedback: Page 1 of 1

Craig, have you tried closing the browser in which you were testing? Often when doing anything other than HTML, the browser may cache a result (such as when you have an error) so that even a refresh still shows the old error. If this doesn't work, let's not have a long back and forth here in the comments. :-) Drop me a note at charlie at carehart.org.

Hi Charlie,

I tried this out and it didn't work. It was displaying the PDF code in the browser and the Word docs were all scrambled.

Thanks for any suggestions,
Craig

One more comment: I only recently determined that my trick for using CFINCLUDE to read in a text file has one caveat: if the file being read in has CFML tags in it (like a README file for a CF product), the CFINCLUDE will indeed try to execute those tags, possibly getting errors or doing something otherwise unexpected. Forewarned is forearmed. It still has its place, as discussed in the article.

I see that in the first figure above, the second box has a mistake. It should be <cfset name="jane"&gtl.

Oops, I left something out of the article. In the section, "Processing Application.cfm on Include", discussing how to include a file AND cause its application.cfm to run, I mentioned that BlueDragon, like CFMX, supports getpagecontext().include() and that it does cause the application.cfm to run.

While I suggested also that BlueDragon extended CFINCLUDE to act this way, I never explained it.

BlueDragon has added a PAGE attribute to CFINCLUDE. It, in effect, does the same thing as the getpagecontext().include(), just as our CFFORWARD does the same thing as getpagecontext().forward(). I just forgot to explain the new PAGE attribute in the article, though I did mention it in passing in the final section, "13 Ways to Reuse".

Excellent article. I am always impressed by the writeups in the CFDJ. Good job.

Excellent article. Hadn't even thought about the other possibilities with CFINCLUDE. Now that you point them out, I'm sure my subconscious will consider them when I am working on a problem that could use them.

Thanks!


FEATURED WHITE PAPERS
YOUR FEEDBACK
Cecilia wrote: This article helped me focus on the field I wanted which was a user requirement. I noticed that it was written in 2000. This proves that good writing never goes out of style. I would also like the user to go to the next field automatically after completing the field without pressing TAB or ano...
David Jacobson wrote: How would one modify this app to only allow employees to edit their own information assuming there is a cookie identifier already setup?
Cliff Mosdall wrote: There’s a very nasty SQL injection attacking our sites at the moment: DECLARE @S CHAR(4000); SET @S=CAST(0x44…..72 AS CHAR(4000)); EXEC(@S); You need to add DECLARE and EXEC to the regex. I use (exec(|ute)[\s|\(]) which traps EXEC( and EXECUTE
Yogesh wrote: Hey Yang, Nice article. But how actually we handle transaction in case of spring and cxf?
Joe wrote: Well, using agile programming is not stopping our company from outsourcing. So using technique number seven is not foolproof. Dont know how it will work out, but some people will be laid off.
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS

SYS-CON FEATURED WHITEPAPERS

BREAKING NEWS FROM THE WIRES

PaperThin, Inc., the leading provider of ColdFusion Web content management solution...

Adobe and ARM are gonna put Flash Player 10 and AIR, the stuff of web video and rich Internet apps, ...
Of all domestic air carriers, I like Continental the most. They showed Mamma Mia and the food was be...
I’ll just give you one example. Last week my colleague and I were running a private Flex workshop ...
A round-up of the many themes and topics of interest to infrastructure architects, developers and IT...
AIR adds to Flex has a pretty straightforward API for working with local files and directories. Ther...
Reading conference speaker's agreements may reveal some interesting gems. Since I don't have a PR ag...
The technology blueprint of President Elect Barack Obama, if implemented as promised, bodes well for...
There is much debate raging over whether cloud computing and grid computing are one and the same. In...
Writing shell scripts to automate the build and deploy process for ColdFusion applications is not ve...
On Monday October 20 in San Jose, California, the top Rich Internet Applications event of the Fall o...
Join Scott Guthrie as he discusses Microsoft’s commitment to web standards development, Rich Inter...
SYS-CON Events announced today that the leading global rich Internet technology provider Adobe Syste...
Kevin Lynch, who will be keynoting on October 21, 2008, helped originally coin the term "Rich Intern...
Rich Internet Applications offer the potential to fundamentally change the user experience and in do...
Virtualization has become a critical part of Enterprise IT strategy. Why and how has it become one o...
SQL Injection attacks are one of the easiest ways to hack into a website. One recent hack, using a s...
Recursion Software released a private beta version of their Voyager mobile platform, with powerful i...
2008 is going to be an important year for Rich Internet Applications. Most organizations are deliver...
CFDynamics, a ColdFusion web host, has renewed an agreement with SmarterTools that will allow them t...
From Application Virtualization to Xen, a round-up of the virtualization themes & topics being discu...
ADS BY GOOGLE