RE: calling UDF's from CustomTags.
> Hi ppl.- > > I have a weird issue here, hope someone can help me a bit > > i have a CustomTag who needs to call some UDF's > > if i put the into the CustomTag i receive this error. > > The routine myfunction has been declared twice in different > templates. > > The error occurred while processing an element with a general > identifier of (), occupying document position (1:1) to (1:1) > in the template file but i have this function only in this file. If you want to embed a function within a custom tag, you need to ensure it is only declared once. If, for example, you have a custom tag foo.cfm, and you do something like this: ... it will run twice. I can't remember ever wanting to embed a function within a custom tag, but I would expect that you could use ThisTag.ExecutionMode to figure out whether to declare it: Alternatively, you could simply put the functions in a CFC or in a persistent scope to get to them from within your custom tag. > i tried put the UDF's in another file and then using > cfmodule adding the UDF files, this include the files (i can > see parsed cfoutputs in there )but can see the functions.- The CFMODULE tag doesn't just include code like CFINCLUDE does. If you place functions within another custom tag, those functions will not be available in your custom tag just because you call the other custom tag. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:204781 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: calling UDF's from CustomTags.
> it will run twice. I can't remember ever wanting to embed > a function within > a custom tag, but I would expect that you could use > ThisTag.ExecutionMode to > figure out whether to declare it: > > > That works with MX. I don't use them either... not that way anyhow. But I tested it some when there was a thread about it here a while back. > Alternatively, you could simply put the functions in a CFC > or in a > persistent scope to get to them from within your custom > tag. Nah, he said he's using CF5. s. isaac dealey 954.522.6080 new epoch : isn't it time for a change? add features without fixtures with the onTap open source framework http://macromedia.breezecentral.com/p49777853/ http://www.sys-con.com/author/?id=4806 http://www.fusiontap.com ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:204796 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: calling UDF's from CustomTags.
Hi David, On CFMX you can avoid this error by putting the function declaration in ...function... -- on CF5 you can only put the function declaration in the same template if the tag will never be used with end-tag syntax. If you need end-tag syntax with CF5, you have to either declare the function outside the tag and place it in the request scope where the tag can access it, or place the function delcaration in a separate template and use hth > Hi ppl.- > I have a weird issue here, hope someone can help me a > bit > i have a CustomTag who needs to call some UDF's > if i put the into the CustomTag i receive > this error. > The routine myfunction has been declared twice in > different templates. > The error occurred while processing an element with a > general identifier of (), occupying document position > (1:1) to (1:1) in the template file > but i have this function only in this file. > i tried put the UDF's in another file and then using > cfmodule adding the UDF files, this include the files (i > can see parsed cfoutputs in there )but can see the > functions.- > The Machine : Coldfusion 5 Professional > : windows 2000 > : using fusebox > any tips... :-) s. isaac dealey 954.522.6080 new epoch : isn't it time for a change? add features without fixtures with the onTap open source framework http://macromedia.breezecentral.com/p49777853/ http://www.sys-con.com/author/?id=4806 http://www.fusiontap.com ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:204794 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: calling UDF's from CustomTags.
> > Alternatively, you could simply put the functions in a CFC or > > in a persistent scope to get to them from within your custom tag. > > Nah, he said he's using CF5. You can't use CFCs in CF 5 obviously, but I'm pretty sure you can store functions in persistent scopes in CF 5. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:204803 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54