Smarty feature proposal: context aware template tags

From: Date: Wed, 28 Nov 2001 09:39:38 +0000
Subject: Smarty feature proposal: context aware template tags
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2067@lists.php.net to get a copy of this message
Hello, I use a lot of custom functions and custom compiler functions in a Content Management System that I am building around Smarty. Now in some cases, I want tags to be 'context aware', by which I mean that tags should know that they are used 'inside' other tags. This kind of nesting happens when a tag needs to render a subtemplate, in which other tags could be used. I was thinking if it would be possible to keep some sort of 'tag stack' in which one can see what tags are currently being rendered. For example, if I have a tag named {foo} and the handler for this tag renders a template that contains a tag {bar}, than inside the handler function for {bar}, $smarty->m_tagstack should contain array("foo","bar"); Another case would be inside sections and includes. If there were for example a {foo} tag inside a {section} inside another {section} in an include, the stack would contain array("include", "section", "section", "foo"); Maybe the stack could also contain other information, like the arguments and properties. What do you think? Greetings, Ivo -- Ivo Jansch <ivo@ibuildings.nl> ibuildings.nl BV - information technology http://www.ibuildings.nl

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