473,385 Members | 1,429 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,385 developers and data experts.

Coldfusion Tips and Tricks

48
Careful use of # signs

The ## (pound) sign is very important in Coldfusion.

Expand|Select|Wrap|Line Numbers
  1. <cfoutput>#variablename#</cfoutput>
is OK.

However using ## inside cfset and cfif tags is not good coding.

The following would be considered bad coding:
Expand|Select|Wrap|Line Numbers
  1. <cfset var1=#variablename#>
  2. <cfif #variablename# eq "">
The ## sign are not necessary inside <cfif> and <cfset> tags because it takes more time to execute.

A good coding standard would be to avoid using pound signs around variables inside cfset and cfif tags:
Expand|Select|Wrap|Line Numbers
  1. <cfset var1=variablename>
  2. <cfif  variablename eq ""></cfif>
A tidbit of information but valuable nonetheless.


cfinclude and custom tags

All of us are familiar with cfinclude and custom tags, both tags are used to include a file. What is the difference between them?

The main difference between cfinclude and custom tag is that the include tag works in a copy-paste manner. The scope of variables used in the calling page is available in the included page. But custom tags are individual ColdFusion pages, variables and other data are not automatically shared between a custom tag and the calling page, so we have to pass it as arguments.
Mar 13 '08 #1
2 5441
acoder
16,027 Expert Mod 8TB
I've moved this to the Articles/howto section.

Thanks for posting this. The pound signs should only be used when necessary, so only surround the variables/functions that need them, not the whole text.
Mar 13 '08 #2
acoder
16,027 Expert Mod 8TB
Rather than having small bits of info, one article with a collection of tips is more useful.
Mar 31 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: John H | last post by:
Can anyone help with why our pages are slow to load during peak-use hours? We run a database site getting 4 million hits a month which becomes painfully slow during peak hours. The slowness is...
2
by: Howdy | last post by:
All: I have been confronted with a huge project of converting a major coldfusion website with a very large number of paid subscribers to a dotnet website. I'm looking for: A) advice on how...
7
acoder
by: acoder | last post by:
This page will link to a number of tutorials. Coldfusion Language Coldfusion Variables Using Coldfusion Variables Coldfusion Image Gallery How to upload a file in Coldfusion How to send...
0
by: travolta003 | last post by:
Windows XP tips and tricks. Learn how to bypass very common windows problems, speed up your system and make it more reliable with useful tips and tricks. http://windowsxpsp2pro.blogspot.com
0
by: travolta004 | last post by:
Windows XP tips and tricks. Learn how to bypass very common windows problems, speed up your system and make it more reliable with useful tips and tricks. http://windowsxpsp2pro.blogspot.com
68
bartonc
by: bartonc | last post by:
I've decide to compile a bunch of your favorite tips and tricks for the Articles section. I found a post yesterday by Chrisjc that is a perfect example. I copied his post over to create Dealing with...
2
bartonc
by: bartonc | last post by:
I've decide to compile a bunch of your favorite tips and tricks for the Articles section. Post your favorite tips and tricks here, in this thread, and I'll copy the best ones to a Tips and Tricks...
0
by: smartfix | last post by:
Windows XP tips and tricks. Learn how to bypass very common windows problems, to speed up your system and make it more reliable with useful tips and tricks. http://windowsxpsp2pro.blogspot.com
8
Frinavale
by: Frinavale | last post by:
Edit Many times we spend hours and hours trying to solve a problem. When we finally figure it out, we want to share it to keep others from suffering the same way! That's why we have this "Tips...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.