Re: [SMARTY-DEV] knowing your template

From: Date: Mon, 12 Dec 2005 17:55:14 +0000
Subject: Re: [SMARTY-DEV] knowing your template
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-2812@lists.php.net to get a copy of this message
--- Attila Csipa <plists@prometheus.org.yu> wrote: > Is there a way to find out for a smarty custom function which > template it is > called from ? I'd like to make a gettext translation > function/modifier and a > logical choice seemed to be to use the template names as domains, but > the > documentation and googling turned up nothing. I know I could assign > it as a > temp variable but it would not solve the problem of nested templates > (include > "inside.tpl"). No, unfortuantely there is not. If you are in a compiler function (or a prefilter) you can access a private member, $compiler->_current_file -- which is the fullpath to the actual template file -- but if you want to use it after compile time, you will need to insert a corresponding assignment into the template code. There shouldn't be a problem with nesting as scope is restored after an include is completed. Greetings, boots __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

« previous php.smarty.dev (#2812) next »