Re: Smarty feature proposal: context aware template tags

From: Date: Wed, 28 Nov 2001 14:31:15 +0000
Subject: Re: Smarty feature proposal: context aware template tags
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2073@lists.php.net to get a copy of this message
Ivo Jansch wrote: > > Hello, > > Anders Janson wrote: > > > the tag. The section tag perhaps being the best example, but I still wonder > > why you would need to know this? Could you give a real-life example of a > > situation where this would be useful ? > > We have a comments system where you can put user comments on a page > (like the online PHP manual) for example by putting a {comments} tag in > a template. This renders a comment.tpl for each comment, which in turn > can contain a {comments} tag to render the subcomments, and so on. > > If I have this stack, I can use this information to determine which > subcomments to render, how much to indent the comments etc. (Our current > solution contains some static and global vars to accomplish the same, > but that's a bit dirty) I don't see how that is so dirty. You can pass a depth parameter to your comments function to help track the nesting depth. On a side note, we use the {insert} tag for things like comments so that they don't get cached with the rest of the page, and it isn't too difficult to build in a caching mechanism into the comments function itself, like caching the data fetched from the db. > > Greetings, > Ivo > > -- > Ivo Jansch <ivo@ibuildings.nl> > ibuildings.nl BV - information technology > http://www.ibuildings.nl > > --- > You are currently subscribed to smarty as: monte@ispi.net > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/ -- Monte Ohrt <monte@ispi.net> http://www.ispi.net/

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