House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Stack overflow in self nested custom tag

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Chris Velevitch
03/09/2010 02:13 AM

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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Barney Boisvert
03/09/2010 02:20 AM

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 -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Chris Velevitch
03/09/2010 02:31 AM

----- 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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dave Watts
03/09/2010 10:32 AM

----- 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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Chris Velevitch
03/09/2010 07:30 PM

> 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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dave Watts
03/09/2010 07:33 PM

> 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.


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 24, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31     

Designer, Developer and mobile workflow conference