Re: [SMARTY-DEV] knowing your template
[email protected] (boots) Mon, 12 Dec 2005 09:55:14 -0800 (PST)
| Newsgroups | php.smarty.dev |
|---|---|
| Message-ID | <[email protected]> |
--- Attila Csipa <[email protected]> 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