|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Stack overflow in self nested custom tag
I'm using CF7.02 and I'm trying to create a custom tag that will beChris Velevitch 03/09/10 02:13 A I haven't tested this, but I'd imagine that the CURRENT tag is on theBarney Boisvert 03/09/10 02:20 A > I haven't tested this, but I'd imagine that the CURRENT tag is on theChris Velevitch 03/09/10 02:31 A > I'm using CF7.02 and I'm trying to create a custom tag that will beDave Watts 03/09/10 10:32 A > Instead of having the processing done in the child tags, you canChris Velevitch 03/09/10 07:30 P > Doesn't that depend on what you're trying to achieved? I can imageDave Watts 03/09/10 07:33 P I'm using CF7.02 and I'm trying to create a custom tag that will be self nested, like:- <cf_ct1> <cf_ct2> <cf_ct2> </cf_ct2> </cf_ct2> </cf_ct1> And in <cf_ct2>, I'm trying to get the data of the parent tag and assigning to a variable in the current tags state:- <cfset lvData=GetBaseTagData(ListGetAt(GetBaseTagList(),2))> But the assignment creates a stack overflow and I don't understand why? Chris -- Chris Velevitch Manager - Adobe Platform Users Group, Sydney m: 0415 469 095 www.apugs.org.au Adobe Platform Users Group, Sydney March 2010: ColdFusion Application Architecture for the Impatient and Using jQuery when Flash is Overkill Date: 29nd Mar 6pm for 6:30 start Details and RVSP on http://groups.adobe.com/posts/148c9056a4 I haven't tested this, but I'd imagine that the CURRENT tag is on the tag stack (as it is with exceptions). Since getBaseTagData operates on names rather than offsets/indexes, it's going to match the current tag, and then return it's own data. So lvData is pointing at one of it's own scopes, which then has to be copied into lvData, and well you can see the problem. However, getBaseTagData accepts an optional second parameter for how many matches it should find before returning, simply moving the ", 2" to the right by one parenthesis will probably solve your problem. Again, I haven't actually tested, but that's what I'd try first. cheers, barneyb ----- Excess quoted text cut - see Original Post for more ----- ----- Excess quoted text cut - see Original Post for more ----- That worked. Thanks. Chris -- Chris Velevitch Manager - Adobe Platform Users Group, Sydney m: 0415 469 095 www.apugs.org.au Adobe Platform Users Group, Sydney March 2010: ColdFusion Application Architecture for the Impatient and Using jQuery when Flash is Overkill Date: 29nd Mar 6pm for 6:30 start Details and RVSP on http://groups.adobe.com/posts/148c9056 ----- Excess quoted text cut - see Original Post for more ----- While Barney's advice is good, and solves your immediate problem, you may want to consider a different approach for nested custom tags. Instead of having the processing done in the child tags, you can simply pass the data from those tags back to the parent tag during its end execution mode, using the CFASSOCIATE tag. This will let you do things that are a bit harder to do in the nested tag itself. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our traini > Instead of having the processing done in the child tags, you can > simply pass the data from those tags back to the parent tag during its > end execution mode, using the CFASSOCIATE tag. This will let you do > things that are a bit harder to do in the nested tag itself. Doesn't that depend on what you're trying to achieved? I can image that's a good solution for simple nesting of tags, but not for highly complex nesting of an indeterminate number of different child tags, child of child tags and recursive nesting. Chris -- Chris Velevitch Manager - Adobe Platform Users Group, Sydney m: 0415 469 095 www.apugs.org.au Adobe Platform Users Group, Sydney March 2010: ColdFusion Application Architecture for the Impatient and Using jQuery when Flash is Overkill Date: 29nd Mar 6pm for 6:30 start Details and RVSP on http://groups.adobe.com/posts/148c9056a4 > Doesn't that depend on what you're trying to achieved? I can image > that's a good solution for simple nesting of tags, but not for highly > complex nesting of an indeterminate number of different child tags, > child of child tags and recursive nesting. No, actually, I find it easier especially in those cases, as long as one single thing is true - you have a specific hierarchy of tags. For example, let's say you have cf_root, cf_branch and cf_leaf. As long as you know that cf_root will only contain cf_branch tags, cf_branch will only contain cf_branch and cf_leaf, it's very easy to perform operations using whatever subtags are present. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite.
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||