Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Temporarily change delimiter??

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
mutant
Smarty Rookie


Joined: 11 May 2004
Posts: 7

PostPosted: Sat Aug 14, 2004 6:28 pm    Post subject: Temporarily change delimiter?? Reply with quote

Hello,

My smarty object uses a custom set of delimiters "{{", "}}". This appears to break the debug.tpl, since it is in "{", "}" format.

Is it possible to temporarily change the delimiter handling within a system?, I could see adding some code in debug.tpl to do this
debug.tpl
Code:

{{php}}
global $smarty;
$smarty->ldelim="{";
$smarty->rdelim="}";
{{/php}}
....


This however didn't work.

I also tried manually placing the debug in the template:
bottom.tpl
Code:

...
</html>
{{php}}
global $smarty;
$smarty->ldelim="{";
$smarty->rdelim="}";
{{/php}}

{debug output=html}
...


Again to no effect.

Whenever I tried to use the debug.tpl with alternate delimiters it doesn't work.

I've resorted to simply dumping the _tpl_vars manually, and while this works, it would be nice to know the 'real' solution.

Code:

{{php}}
global $smarty.
vardump($smarty->_tpl_vars);
{{/php}}


Mucho Grassyass to anyone who can shed some light on this.
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sat Aug 14, 2004 8:38 pm    Post subject: Reply with quote

make your own debug.tpl (maybe just use the one from the distribution and search-and-replace the delimiters) and point $smarty->debug_tpl to it.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Sun Aug 15, 2004 12:33 am    Post subject: Reply with quote

What's weird to me is that core.display_debug_console.php seems to already have code in it to deal with this (it temporarily re-assigns the delimiters):

http://cvs.php.net/co.php/smarty/libs/core/core.display_debug_console.php?r=1.10

What version of Smarty are you using?

FYI: when using PHP blocks, you need not resort to globals for the Smarty object as $this will resolve to the instanced Smarty object's context:

{{php}}
vardump($this->_tpl_vars);
{{/php}}
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sun Aug 15, 2004 2:31 pm    Post subject: Reply with quote

boots wrote:
What's weird to me is that core.display_debug_console.php seems to already have code in it to deal with this


d'oh! of course. and that works for me fine, too.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP