Every tag in your library should include a "private" file from the
taglib that defines the globals, in a conditional of course.  That way
whatever tag is called first will prepare the request.  It'll add a
bit of code to all your tag files, but it'll keep everything properly
encapsulated inside the taglib.  For example:

main.cfm/input.cfm/select.cfm/etc.
<cfif NOT structKeyExists(request, "__form_tag_library_initialized")>
  <cfinclude template="_init.cfm" />
</cfif>
....

_init.cfm
<cffunction name="......." ...>
</cffunction>
<cfset request..... = .... />
....

cheers,
barneyb

On 10/31/06, Peter Boughton <[EMAIL PROTECTED]> wrote:
> I have a custom tag package for form controls, which I'm defining like so:
> <cfimport prefix="form" taglib="/common/customtags/form"/>
>
> Most of the custom tags in the package share a common function, which I 
> simply store in the Request scope.
>
> Usually this is fine because each page starts <form:main> and inside that I 
> can define the function in there.
>
> However, for a project I'm now working on, I'm using Fusebox and content 
> variables to make things nice and modular, and I can now no-longer guarantee 
> that the form:main tag will be called before other tags in the package.
>
> So, I'm hoping someone can suggest a better solution for this other than 
> requiring a <form:prepare/> after every single cfimport?
>
> (Or indeed has anyone figured out how to be able to do cfimport just once in 
> Application.cf~ yet?)
>
> Thanks,
>
> Peter
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:258585
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to