RE: Correctly using CFOUTPUT
"Never" is too strong a word. If you have a CFOUTPUT at the top of the page and another CFOUTPUT at the bottom of the page, it's not better to enclose the entire page in one CFOUTPUT tag as you're suggesting. Extraneous code, no. Extra code, yes - if it improves performance, reliability, or readibility. Chris Norloff -- Original Message -- From: "Mark Warrick" <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] Date: Tue, 29 May 2001 09:14:33 -0700 >You should never add extraeneous code into your templates, therefore Listing >1 would be the better candidate. > >---mark > > >Mark Warrick - Fusioneers.com >Email: [EMAIL PROTECTED] >Phone: 714-547-5386 >http://www.fusioneers.com >http://www.warrick.net > > >> -Original Message- >> From: J Winter [mailto:[EMAIL PROTECTED]] >> Sent: Tuesday, May 29, 2001 6:48 AM >> To: CF-Talk >> Subject: Correctly using CFOUTPUT >> >> >> Hi, I've always been curious about this. What is the correct way? Does it >> matter? >> >> Listing 1: >> >> >> >> >> #var1# >> >> >> #var2# >> >> >> >> >> Listing 2: >> >> >> >> #var1# >> >> >> #var2# >> >> >> >> Is there an unwritten rule; if there are more than 4 (or ?) vars in a page >> Listing 1 is a good way to do it else Listing 2 is recommended? >> I'm assuming >> when using Listing 1 would always be >> applicable. >> >> Thanks for any help! >> >> Josh >> >> >> > ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Correctly using CFOUTPUT
We discussed this on the list no more than a few weeks ago. While intuitively (at least to me) it would seem that a CFOUTPUT loop would execute faster than a CFLOOP, that simply is not the case. I think we pretty much reached the concensus that while CFLOOP is faster, the difference was so small that it was not worthy of making a fuss over. Brian - Original Message - From: "Bill Killillay" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Thursday, May 31, 2001 3:35 PM Subject: RE: Correctly using CFOUTPUT > Since when is CFLOOP "faster" then CFOUTPUT? I have seen on this list many, > many times that CFLOOP is one of the slowest tags in CF... I see your point > about not wanting to execute more code then is needed, but a lot of it > depends on what your doing. But in a show down between CFOUTPUT and CFLOOP, > I say that CFOUTPUT with a query attribute beats CFLOOP hands down every > day... > ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Correctly using CFOUTPUT
I've always been curious about that. I saw Ben Forta speak once about that issue, and have seen that here is well. Is it just that the looping PCode is just a lot more cumbersome because Allaire grouped so many different kind of looping controls in one tag? I don't get it, loops are usually low overhead in other programming languages. Hmm.. Maybe query based loops is where the problem lies. They might have to do a lot of conversion between a clean loop and a query resolution that adds the overhead. -Bill www.brainbox.tv - Original Message - From: "Bill Killillay" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Thursday, May 31, 2001 4:35 PM Subject: RE: Correctly using CFOUTPUT > Since when is CFLOOP "faster" then CFOUTPUT? I have seen on this list many, > many times that CFLOOP is one of the slowest tags in CF... I see your point > about not wanting to execute more code then is needed, but a lot of it > depends on what your doing. But in a show down between CFOUTPUT and CFLOOP, > I say that CFOUTPUT with a query attribute beats CFLOOP hands down every > day... > > -Original Message- > From: Philip Arnold - ASP [mailto:[EMAIL PROTECTED]] > Sent: Thursday, May 31, 2001 2:00 PM > To: CF-Talk > Subject: RE: Correctly using CFOUTPUT > > > > Hi, I've always been curious about this. What is the correct way? Does it > > matter? > > > Is there an unwritten rule; if there are more than 4 (or ?) vars in a page > > Listing 1 is a good way to do it else Listing 2 is recommended? > > I'm assuming when using Listing 1 would > > always be applicable. > > OK, there are 2 ways to look at this; > 1) What's easier for you (and your team) to read and update > 2) What's faster on then server when it's PCode > > In answer to this, Listing 1 is always easier to read, but is slower on the > server > "Why?" you ask (sounds of "Why?" from all over the world)... > > Here's how the CF Server looks at a template (if you don't have CFSetting > EnableCFOutputOnly="Yes" on); > It sends everything straight to the browser that's not a CF tag outside of a > CFOutput without even thinking, once it reaches a CFOutput it has to scan > through the code to find if anything requires any conversion from > function/variable/field contents into displayable values and then converts > those... > > When you don't have any functions/variables/fields in the code, you're > effectively making CF work for nothing > > Remeber that a file being larger in size (before PCode) means nothing to how > fast it might run on the server - it's the actual work that the server is > doing that's more important > > If you wanted the best performance from a CFOutput query="" tag, then you > should use CFLoop query="" and only CFOutput the fields > > Hope this helps explain why and why not to use CFOutput on everything > > Philip Arnold > Director > Certified ColdFusion Developer > ASP Multimedia Limited > T: +44 (0)20 8680 1133 > > "Websites for the real world" > > ** > This email and any files transmitted with it are confidential and > intended solely for the use of the individual or entity to whom they > are addressed. If you have received this email in error please notify > the system manager. > ** > ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Correctly using CFOUTPUT
Great, thanks for your expertise Philip. Just what I was looking for. Can you explain this part a little more? I didn't quite get it. >If you wanted the best performance from a CFOutput query="" tag, then you >should use CFLoop query="" and only CFOutput the fields Thanks, Josh -Original Message- From: Philip Arnold - ASP [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 31, 2001 2:00 PM To: CF-Talk Subject: RE: Correctly using CFOUTPUT > Hi, I've always been curious about this. What is the correct way? Does it > matter? > Is there an unwritten rule; if there are more than 4 (or ?) vars in a page > Listing 1 is a good way to do it else Listing 2 is recommended? > I'm assuming when using Listing 1 would > always be applicable. OK, there are 2 ways to look at this; 1) What's easier for you (and your team) to read and update 2) What's faster on then server when it's PCode In answer to this, Listing 1 is always easier to read, but is slower on the server "Why?" you ask (sounds of "Why?" from all over the world)... Here's how the CF Server looks at a template (if you don't have CFSetting EnableCFOutputOnly="Yes" on); It sends everything straight to the browser that's not a CF tag outside of a CFOutput without even thinking, once it reaches a CFOutput it has to scan through the code to find if anything requires any conversion from function/variable/field contents into displayable values and then converts those... When you don't have any functions/variables/fields in the code, you're effectively making CF work for nothing Remeber that a file being larger in size (before PCode) means nothing to how fast it might run on the server - it's the actual work that the server is doing that's more important If you wanted the best performance from a CFOutput query="" tag, then you should use CFLoop query="" and only CFOutput the fields Hope this helps explain why and why not to use CFOutput on everything Philip Arnold Director Certified ColdFusion Developer ASP Multimedia Limited T: +44 (0)20 8680 1133 "Websites for the real world" ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. ** ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Correctly using CFOUTPUT
Since when is CFLOOP "faster" then CFOUTPUT? I have seen on this list many, many times that CFLOOP is one of the slowest tags in CF... I see your point about not wanting to execute more code then is needed, but a lot of it depends on what your doing. But in a show down between CFOUTPUT and CFLOOP, I say that CFOUTPUT with a query attribute beats CFLOOP hands down every day... -Original Message- From: Philip Arnold - ASP [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 31, 2001 2:00 PM To: CF-Talk Subject: RE: Correctly using CFOUTPUT > Hi, I've always been curious about this. What is the correct way? Does it > matter? > Is there an unwritten rule; if there are more than 4 (or ?) vars in a page > Listing 1 is a good way to do it else Listing 2 is recommended? > I'm assuming when using Listing 1 would > always be applicable. OK, there are 2 ways to look at this; 1) What's easier for you (and your team) to read and update 2) What's faster on then server when it's PCode In answer to this, Listing 1 is always easier to read, but is slower on the server "Why?" you ask (sounds of "Why?" from all over the world)... Here's how the CF Server looks at a template (if you don't have CFSetting EnableCFOutputOnly="Yes" on); It sends everything straight to the browser that's not a CF tag outside of a CFOutput without even thinking, once it reaches a CFOutput it has to scan through the code to find if anything requires any conversion from function/variable/field contents into displayable values and then converts those... When you don't have any functions/variables/fields in the code, you're effectively making CF work for nothing Remeber that a file being larger in size (before PCode) means nothing to how fast it might run on the server - it's the actual work that the server is doing that's more important If you wanted the best performance from a CFOutput query="" tag, then you should use CFLoop query="" and only CFOutput the fields Hope this helps explain why and why not to use CFOutput on everything Philip Arnold Director Certified ColdFusion Developer ASP Multimedia Limited T: +44 (0)20 8680 1133 "Websites for the real world" ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. ** ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Correctly using CFOUTPUT
> Hi, I've always been curious about this. What is the correct way? Does it > matter? > Is there an unwritten rule; if there are more than 4 (or ?) vars in a page > Listing 1 is a good way to do it else Listing 2 is recommended? > I'm assuming when using Listing 1 would > always be applicable. OK, there are 2 ways to look at this; 1) What's easier for you (and your team) to read and update 2) What's faster on then server when it's PCode In answer to this, Listing 1 is always easier to read, but is slower on the server "Why?" you ask (sounds of "Why?" from all over the world)... Here's how the CF Server looks at a template (if you don't have CFSetting EnableCFOutputOnly="Yes" on); It sends everything straight to the browser that's not a CF tag outside of a CFOutput without even thinking, once it reaches a CFOutput it has to scan through the code to find if anything requires any conversion from function/variable/field contents into displayable values and then converts those... When you don't have any functions/variables/fields in the code, you're effectively making CF work for nothing Remeber that a file being larger in size (before PCode) means nothing to how fast it might run on the server - it's the actual work that the server is doing that's more important If you wanted the best performance from a CFOutput query="" tag, then you should use CFLoop query="" and only CFOutput the fields Hope this helps explain why and why not to use CFOutput on everything Philip Arnold Director Certified ColdFusion Developer ASP Multimedia Limited T: +44 (0)20 8680 1133 "Websites for the real world" ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. ** ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Correctly using CFOUTPUT
You should never add extraeneous code into your templates, therefore Listing 1 would be the better candidate. ---mark Mark Warrick - Fusioneers.com Email: [EMAIL PROTECTED] Phone: 714-547-5386 http://www.fusioneers.com http://www.warrick.net > -Original Message- > From: J Winter [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, May 29, 2001 6:48 AM > To: CF-Talk > Subject: Correctly using CFOUTPUT > > > Hi, I've always been curious about this. What is the correct way? Does it > matter? > > Listing 1: > > > > > #var1# > > > #var2# > > > > > Listing 2: > > > > #var1# > > > #var2# > > > > Is there an unwritten rule; if there are more than 4 (or ?) vars in a page > Listing 1 is a good way to do it else Listing 2 is recommended? > I'm assuming > when using Listing 1 would always be > applicable. > > Thanks for any help! > > Josh > > > ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Correctly using CFOUTPUT
Hi, let's assume that there is no query for the CFOUTPUT tag. Which would be better coding style? I've seen it done both ways: CFOUTPUTing each variable and CFOUTPUTing/encapsulating the entire template. Sometimes when I run into things I think "what do the pros do?". What would the pros do in this situation? Josh -Original Message- From: Katherine Maltby [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 29, 2001 10:00 AM To: CF-Talk Subject: RE: Correctly using CFOUTPUT It depends how you want the results to be displayed, but I'd recommend putting the cfoutput tags inside the table before the as otherwise you'll open a new table for each line of results, which isn't good if you're pulling rows and rows back from a database. Kath Web Production Director -- United Kingdom http://www.thoughtbubble.co.uk/ Ph: +44 (0) 20 7387 8890 -- New Zealand http://www.thoughtbubble.co.nz/ Ph: +64 (0) 9 488 9131 The information in this email and in any attachments is confidential and intended solely for the attention and use of the named addressee(s) . Any views or opinions presented are solely those of the author and do not necessarily represent those of Thoughtbubble. This information may be subject to legal, professional or other privilege and further distribution of it is strictly prohibited without our authority. If you are not the intended recipient, you are not authorised to disclose, copy, distribute, or retain this message. Please notify us on +44 (0) 20 7387 8890 -Original Message- From: J Winter [mailto:[EMAIL PROTECTED]] Sent: 29 May 2001 14:48 To: CF-Talk Subject: Correctly using CFOUTPUT Hi, I've always been curious about this. What is the correct way? Does it matter? Listing 1: #var1# #var2# Listing 2: #var1# #var2# Is there an unwritten rule; if there are more than 4 (or ?) vars in a page Listing 1 is a good way to do it else Listing 2 is recommended? I'm assuming when using Listing 1 would always be applicable. Thanks for any help! Josh ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Correctly using CFOUTPUT
It depends how you want the results to be displayed, but I'd recommend putting the cfoutput tags inside the table before the as otherwise you'll open a new table for each line of results, which isn't good if you're pulling rows and rows back from a database. Kath Web Production Director -- United Kingdom http://www.thoughtbubble.co.uk/ Ph: +44 (0) 20 7387 8890 -- New Zealand http://www.thoughtbubble.co.nz/ Ph: +64 (0) 9 488 9131 The information in this email and in any attachments is confidential and intended solely for the attention and use of the named addressee(s) . Any views or opinions presented are solely those of the author and do not necessarily represent those of Thoughtbubble. This information may be subject to legal, professional or other privilege and further distribution of it is strictly prohibited without our authority. If you are not the intended recipient, you are not authorised to disclose, copy, distribute, or retain this message. Please notify us on +44 (0) 20 7387 8890 -Original Message- From: J Winter [mailto:[EMAIL PROTECTED]] Sent: 29 May 2001 14:48 To: CF-Talk Subject: Correctly using CFOUTPUT Hi, I've always been curious about this. What is the correct way? Does it matter? Listing 1: #var1# #var2# Listing 2: #var1# #var2# Is there an unwritten rule; if there are more than 4 (or ?) vars in a page Listing 1 is a good way to do it else Listing 2 is recommended? I'm assuming when using Listing 1 would always be applicable. Thanks for any help! Josh ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Correctly using CFOUTPUT
I personally have a tendency to use Listing 1's format more often than I use the one in Listing 2. The only difference is that I put in my table tags BEFORE my CFOUTPUT tags, that way if I'm looping through a query's results, I don't have a new table being created for each record. :) Scott Wolf Goodfriend Computer Training -Original Message- From: J Winter [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 29, 2001 9:48 AM To: CF-Talk Subject: Correctly using CFOUTPUT Hi, I've always been curious about this. What is the correct way? Does it matter? Listing 1: #var1# #var2# Listing 2: #var1# #var2# Is there an unwritten rule; if there are more than 4 (or ?) vars in a page Listing 1 is a good way to do it else Listing 2 is recommended? I'm assuming when using Listing 1 would always be applicable. Thanks for any help! Josh ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Correctly using CFOUTPUT
Hi, I've always been curious about this. What is the correct way? Does it matter? Listing 1: #var1# #var2# Listing 2: #var1# #var2# Is there an unwritten rule; if there are more than 4 (or ?) vars in a page Listing 1 is a good way to do it else Listing 2 is recommended? I'm assuming when using Listing 1 would always be applicable. Thanks for any help! Josh ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists