***************************** Team Allaire *****************************
Paul,
I had the HARDEST time "getting" cf_bodycontent. Now, this made me feel very
stupid--I mean, it's only 4 lines of code--how hard can it be? But I kept
asking, "Where would I use this?" It turns out that the reason I couldn't
get it was because I never do the HTML/layout for a project and this is
really where cf_bodycontent shines. It's really a way of having a standard
framework set up, into which you "drop" code that's already been run. For
example, you might have a framework of an HTML table. On the left column,
you want a navigation bar. On the right, you want the page content for
wherever you happen to be. <cf_bodycontent> lets you run your navigation bar
and save that as a variable and run your main page content and save that as
a variable. Now, you can just drop these variables into the framework.
Here's a little bit of code...
<table>
<tr>
<td>#request.NavBar#</td>
<td>#request.PageContent#</td>
<tr>
</table>
You get those variables by wrapping your code in <cf_bodycontent> and then
naming that particular bit of code.
<cf_bodycontent name="PageContent">
<cfquery datasource="#request.dsn#" name="UserInfo">
SELECT * FROM User WHERE userID = #attributes.userID#
</cfquery>
<cfoutput>Hello there, #UserInfo.firstName#!</cfoutput>
</cf_bodycontent>
Once you get the basic concept, there are all sorts of more sophisticated
things you can do with it. I've said before, this is maybe the most useful 4
lines of CF code ever written! Kudos to Steve.
Hal
-----Original Message-----
From: Paul Smith [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 25, 2001 10:01 AM
To: Fusebox
Subject: RE: Hungarian Notation
You got that right! Hell, I haven't even got my arms around CF_BodyContent
I hurts my head every time I try to figure it out.
best, paul
At 07:48 AM 5/24/01 -0800, you wrote:
>Ha! I think it's safe to say that many of us still haven't figured out what
>this XFB thing is...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists