Shannon,

In some ways you are right, but for code reuse I still believe the
custom tag is the way to go.

Say you put the code in /webroot/myIncludes/myReusableCode.cfm.
Someone working in /webroot/Application1/SubApp1/report would have to
use either <cfinclude template="../../myIncludes/myReusableCode.cfm" />
or <cfinclude template="/webroot/myIncludes/myReusableCode.cfm" /> if
the /webroot is mapped correctly.

Using the custom tag method you can put in <cf_myReusableCode /> and it
works even if you move the cfm files that reference that tag.  If you
use the ../.. method however when you move files around, each file would
then have to be edited. The mapping method would still work.  Another
advantage of using this method is if they needed to override your custom
tag with one similar all they have to do is create a file of the same
name in the current directory.

Also, it's not hard at all to add a directory to use as custom tags. You
make the directory and tell them to add it to the list of directories to
search. For the administrators, that's just a few characters typed into
a field in the CF Administrator. Very simple.

Steve

-----Original Message-----
From: Shannon Rhodes [mailto:[email protected]] 
Sent: Thursday, May 13, 2010 10:54 AM
To: cf-talk
Subject: Re: Which code reuse method?


<snip>
I somewhat disagree.  The easiest way to deal with a straightforward
code snippet that takes no input parameters is a simple cfinclude.  I
can copy/paste the code directly from the page for which it was
originally written, and then done.  With a custom tag, there is a tiny
bit extra to consider (scope issues are different, handling the lack of
an end tag).  It's not that it's a big deal, I'm just wondering what the
advantage would be.  In this case, the advantage may well be simply the
need to demonstrate code reuse to other developers who may use includes
inappropriately---that is a compelling case.</snip>

<snip>
I'm unclear here...developers do not have access to the Administrator
(only management), so I guess I'd need to make the case that they need
to create a custom tags folder for us?</snip>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333646
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to