Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

[SMARTY] Getting information about the template name
Hello,

I would like to access the name of current template
directly from the Smarty-object (inside my own BLOCK-function).
Is this possible? I searched the documentation but
found only {$smarty.template}, which does not help me.

Thanks,
Erik

Report this thread to moderator Post Follow-up to this message
Old Post
Erik Schmitt
06-06-05 08:59 AM


Re: [SMARTY] Getting information about the template name
Erik Schmitt wrote:
: I would like to access the name of current template
: directly from the Smarty-object (inside my own
BLOCK-function).
: Is this possible? I searched the documentation but
: found only {$smarty.template}, which does not help me.

a quick print_r reveals it's stashed in the smarty
object. try a function like this:

function myfunc($args, $smarty){
$tmpl = $smarty->_plugins['function']['myfunc'][1];
..
}
$smarty->register_function('myfunc', 'myfunc');

but that doesn't work for included templates. to get
the template name inside includes you'll need to patch
your Smarty.class.php file with the patch here:

http://code.iamcal.com/php/smarty/c...mplate/diff.txt

then you can access it like this:

function myfunc($args, $smarty){
$tmpl = $smarty->current_template();
..
}


--cal

Report this thread to moderator Post Follow-up to this message
Old Post
Cal Henderson
06-06-05 01:58 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Smarty Templates archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:47 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.