You have to do it as an include, the function declaration actually happens on parsing of the template you see, so when your custom tag gets hit on the end tag that parser "reads" the custom tag template again, and sees a declaration for isOperator - no matter that it won't be used this time around. A CFINCLUDE'd file won't be parsed ("read") until the CFINCLUDE is executed, so it is an effective work around.
<CFIF NOT isDefined("isOperator")> <CFINCLUDE TEMPLATE="thisOperator.cfm"> </CFIF> and thisOperator.cfm contains <cfscript> function IsOperator( value ) { blah blah blah; return something; } </cfscript> ----- Original Message ----- From: "heirophant mm" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Saturday, May 18, 2002 2:27 AM Subject: UDFs in a Custom Tag problem > Hello developers, > > I'm writing a custom tag, and I've written some UDFs to clean up some of the code within the custom tag. Only the custom tag uses these UDFs - they're pretty specialized - so I thought it would be easiest to just put them right inside the template for the custom tag. Here's my general structure: > > <cfif thistag.executionmode EQ "start"> > <cfscript> > function IsOperator( value ) { > blah blah blah; > return something; > } > </cfscript> > more code > </cfif> > <cfif thistag.executionmode EQ "end"> > some output, etc. > </cfif> > > I get this error: > "Routines cannot be declared more than once. The routine IsOperator has been declared twice in different templates." > > I have found that this error occurs at the very beginning of the "end ExecutionMode" of the tag. > > I can't figure out how to stop this error. Any ideas? Thanks > > Mike Mertsock > Alfred University Webteam > > > > ________________________________________________________ > Outgrown your current e-mail service? > Get a 25MB Inbox, POP3 Access, No Ads and No Taglines with LYCOS MAIL PLUS. > http://login.mail.lycos.com/brandPage.shtml?pageId=plus > FAQ: http://www.thenetprofits.co.uk/coldfusion/faq > Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ > Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists > ______________________________________________________________________ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists