Tally List : mailing list management, archiving, and analysis
click for archive home
 
Archive of:
CFtipsPlus
Cold Fusion tips email (external)
 
home
24 hour view
quick stats
weekly updates
 
all tallylists
corporate solutions
archive your favorite
help / feedback


Search the Tallylist search by keyword:

About Cold Fusion Tips :
product's home
product's list home
 
  Archived TallyList / CFtipsPlus: 
Subject: To <cfscript> or not to <cfscript> | Where am I?
Nathan Stanford (23p/+0r)     Posted: Friday 26 Jan 2001
This post: 142 views, +0 rating

============== ColdFusion TIPS PLUS ColdFusion 01 Volume 01 Issue 04 =============================================================== http://www.cftipsplus.com ============== Issue 00043 ============== I. Comments:

II. ColdFusion Tip: To <cfscript> or not to <cfscript> By Kevin Schmidt, Web Technology Manager Allaire Certified Cold Fusion Developer schmidt@pwb.com

III. ColdFusion Tip: Where am I? By Nathan Stanford admin@nsnd.com

============== I. Comments: I met Kevin Schmidt at the Allaire Conference in Washington, DC. We seemed to hit off. He is a friend and a great guy. If your looking for someone to answer your questions here is someone you can ask. He is not afraid to try new things.

=============================================================== If you have any suggestions please email me at cftips@nsnd.com. ===============================================================

=============================================================== II. ColdFusion Tip: To <cfscript> or not to <cfscript> By Kevin Schmidt, Web Technology Manager Allaire Certified Cold Fusion Developer schmidt@pwb.com ===============================================================

That's a good question. What is <cfscript> and when is the best time to use it? The <cfscript> tag is used to enclosecfscript code. With <cfscript> you have access to use ColdFusion functions expressions, and operators. You can also set and use ColdFusion varaibles with <cfscript>. The syntax of <cfscript> is similar to that of Javascript but not identical. If you want all the gritty details there is a section in Developing Web Applications with ColdFusion from Allaire that explains all the differences in syntax. Now that we know what <cfscript> is when would we want to use it? Take a look at the code below:

<CFSET first_name = "Kevin"> <CFSET middle_initial = "A."> <CFSET last_name = "Schmidt">

Instead of using all <CFSET> tags to set up the above variables we could use <cfscript>. The code below illustrates how <cfscript> works.

<cfscript> first_name = "Kevin"; middle_initial = "A."; last_name = "Schmidt"; </cfscript>

Both of these examples do the same thing. They set up variables for first name, middle initial, and last name, but by using <cfscript> you get a slight gain in performance and save a few extra keystrokes. Thus the next time you find yourself using the <CFSET> tag or setting up a structure try using <cfscript> instead.

If you have questions or comments or suggestions for a future tip please email me at schmidt@pwb.com. Until next week, Happy CF'ing

Kevin Schmidt Allaire Certified Cold Fusion Developer Coming next week: Arrays

============== III. ColdFusion Tip: Where am I? By Nathan Stanford admin@nsnd.com ==============

<cfset PhysicalPath = ListDeleteAt(cgi.path_translated,ListLen (cgi.path_translated,"\"),"\")>

Someone in one of the ColdFusion lists was requesting a way to get the path without the filename on the end of it. I coded out one way of doing it but another developer came up with this much shorter way to do it. The above code will get the path to the current directory. I have in a previous tip shown you how to get the current file name so you could use it in your scripts and custom tags. Example would be you create a custom tag and encrypt it and someone wants to rename it. Then if your code is looking at the actual file name that you're currently in. Your code will not break but if on the other hand you have it hard coded in your code then it will break.

============== Publisher and Creator: Nathan Stanford, mailto:admin@cftipsplus.com Web Developers: Kevin Schmidt, mailto:schmidt@pwb.com Dain Anderson, mailto:danderson@cftipsplus.com ============== Copyright (c) 2000 - 2001 CFTIPSPLUS.COM and NSND.COM Permission is granted to circulate this publication via MANUAL forwarding by email to friends provided that the text is forwarded in its entirety and no fee is charged. ==============

============== To unsubscribe: unsubscribe-cftips@nsnd.com

To subscribe: subscribe-cftips@nsnd.com ==============

____________________________________________________________ T O P I C A -- Learn More. Surf Less. Newsletters, Tips and Discussions on Topics You Choose. http://www.topica.com/partner/tag01


Similar Subject Line Posts (+/- two weeks of this post)
To <cfscript> or not to <cfscript> | Where am I?  26 Jan 2001 (this post)   (142 v/ +0 r)
 

Send a reply to the CFtipsPlus list!
click to send a reply! NOTE: Many lists will reject your post unless you have already registered with them. Also - don't forget the right account to send from (for those with multiple emails!)

Feedback: If this post was exceptionally helpful, please help by giving this post a positive review.

 

TallyList : copyright Ububik - 2000