Re: proposal for tagnesting (begin/end tags)

From: Date: Mon, 17 Dec 2001 11:19:57 +0000
Subject: Re: proposal for tagnesting (begin/end tags)
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2318@lists.php.net to get a copy of this message
Andrei Zmievski wrote: > On Fri, 14 Dec 2001, Ivo Jansch wrote: > > I think this will only work for one set of begin and end tags. If you > > have nested tags, that won't work. > > Why not? Output buffering can be nested. For example, hypothetical {input},{button} or {checkbox} tags might need to know the name of the equally hypothetical tag pair {form}...{/form} on some previous nesting level. Of course this can be handled somehow by the {/form} handler, but it would involve dummy placeholders in the output, temporary buffers etc, that can not be handled until the end tag appears. Ugly and definitely not a flexible method. Ivo Jansch already suggested a tag stack to enable context aware template tags. This idea could be extended to include a tag argument stack, where all the arguments from all previous nesting levels could be reached if needed. If my hypthetical {button} tag needs to know the name of the form that holds the button, it could just scan the argument stack to find the name of the form. With these two stacks, I think even the suggested solution of buffering output and handle it in a closing tag would work fine. The core code would be fast and simple, and the programmer that implements nested tag handlers could make his code as complex as he desires. He would have access to everything he needs to implement true context aware tags if he wants. /Anders

« previous php.smarty.general (#2318) next »