Custom Tags are very useful because they process everything separately from
the calling template. That means any variables created inside the custom tag
do not overwrite variables used in your calling template. The only variable
names you need to be careful with are the variable names that are returned
from the Custom Tag. Using a naming convention such as appending the name of
the Custom Tag to the name of the return variables helps avoid this problem.
In my experience with Fusebox, this return variable name conflict is less of
an issue because when a template is called through the Fusebox methodology,
all of the variable types are converted to Attribute type variables. So when
a template calls a Custom Tag the return variables are local type variables
(referenced using the "Variables" prefix).
The way ColdFusion finds a Custom Tag is what affects performance. When a
Custom Tag is called using <cf_(tag)>, ColdFusion looks first in the current
directory of the calling template for the Custom Tag referenced. If it does
not find it there, ColdFusion starts at the \Cfusion\CustomTags directory
and works down through its subdirectories. So every time a Custom Tag is
called in this manner a whole bunch of directory searching is done.
Calling a Custom Tag using <cfmodule name/template=(tag)> accomplishes the
same task of running a process which is isolated from the calling template,
but it points ColdFusion directly to the Custom Tag referenced. ColdFusion
looks in one place for the tag and does not look anywhere else. This helps
performance in an environment where Custom Tags are used heavily to
encapsulate various functions. In the Advanced ColdFusion Development class,
my instructor recommended using CFMODULE to call custom tags in order to
increase performance while allowing you to organize your Custom Tags in a
directory structure that suits your needs.
Anytime I run into a situation where I am processing some set of variables
and need to do that again in some other template...I create a custom tag and
call it using CFMODULE.
I mainly use CFINCLUDE to assemble pieces of a Web page...which is the glory
of Fusebox! I've experienced a couple of situations where I needed to use
CFINCLUDE to add a reusable function to a set of templates in a specific
directory. In these situations, I felt it was the best solution for code
reuse and maintainability.
Scott
----------
Scott Knaub
Web & Database Developer
Benefit Planners
194 S. Main Street
Boerne, TX 78006
Phone: 210-558-2100 x-1475
Fax: 210-558-2151
E-mail: [EMAIL PROTECTED]
Web: http://www.benplan.com
-----Original Message-----
From: Nick & Loretta Pioch [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 08, 2000 10:22 PM
To: [EMAIL PROTECTED]
Subject: When to use what (Re: custom tags vs. cfincludes)
OK...the below is a definition(?) of when to call something as
cf_<something>
What is everyone else's take on when to use what...
(not just what is the differrence between the 3)
What's your rules of thumb?
When do you call a file by
<cf_(tag)>
<cfmodule name/template=(tag)>
<cfinclude template=(tag)>
???
Thanks for any good insight into this!
-- Loretta Pioch
JME Maxwell wrote:
...
> Our rule of thumb for development if it takes inputs or if it returns
> information it is called as a custom tag. This gives us 100% flexibility
to
> deal with any changes to graphics or functions without needing to worry at
> all about affecting the program downstream.
>
> We also only return 1 variable from a custom tag and the variable returned
> has the name of the file it called (minus the ".cfm").
----------------------------------------------------------------------------
--
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.