On Thu, May 13, 2010 at 10:54 AM, Shannon Rhodes <shan...@rhodesedge.com>wrote:

>
> <snip>Custom tag is just that:  a bit of code that can be called in a
> single tag,
> that's all.  Nothing 'overkill' about it to implement for a simple
> computation.  <cf_getMyLink relativePath="/path/to/mytemplate.cfm"
> environment="development" /> seems fairly straightforward.</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>If that is the case, I would recommend making it a custom tag and
> sticking
> it in the custom tags folder in the CF admin.That way it is avalible to
> everyone with out having to deal with mappings and all that.</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?
>
>
>
I think components still make the most reusable choice for things like this.
I throw all my utility type functions into one cfc and call the correct
function according to what is required, even if no input is required it
still has the desired affect of doing xyz. These don't change often so I
normally put them in the application scope

<cfset application.utilities = CreateObject("component",
"components.utilities").init()>

Then just call the required function when needed.

<cfoutput>Hi visitor, the phrase of the day is
#application.utilities.phraseOfDay()#<cfoutput>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:333645
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to