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

debug won't open console on inherited templates

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


Joined: 27 Jul 2011
Posts: 7

PostPosted: Thu Dec 01, 2011 1:10 am    Post subject: debug won't open console on inherited templates Reply with quote

I recently was trying to see if the data I wanted was being passed correctly to my template.

I found that setting setDebugging(true) would show the console window but if I setDebugging(false) and used {debug} in the template I wanted to check the console would not open.

As it turned out it seems that the culprit was that I am using an inherited template system with blocks (this is so awesome BTW Thanks to the devs for this feature!).
If I comment out the {extends file=.....} code the debug window show up straight away with my current templates vars displayed.

I would think this is a bug as the docs do not say anything about issues with inheritance for the {debug} command.

Just to clarify in code here is a base example

This fails to open the console
Code:
{* Smarty Template *}
{debug}

{extends file='private/admin_layout.tpl'}
{block name='content' append}
some content here
{/block}


this opens the console but does not display anything on the main page due to the fact that the core of the template is not included
Code:
{* Smarty Template *}
{debug}
{*
{extends file='private/admin_layout.tpl'}
*}
{block name='content' append}
some content here
{/block}


EDIT: I am running Smarty 3.1.4

I hope this can be fixed soon.

Please let me know if there is clarification needed.

Thanks
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Thu Dec 01, 2011 1:18 am    Post subject: Reply with quote

It'n not a bug.

In child templates everthing except {extends} and {block} tags is ignored as also stated in documentation.

You have to place the {debug} tag in the parent template.
Back to top
View user's profile Send private message
CircleDev
Smarty Rookie


Joined: 27 Jul 2011
Posts: 7

PostPosted: Thu Dec 01, 2011 1:48 am    Post subject: Reply with quote

U.Tews wrote:
It'n not a bug.

In child templates everthing except {extends} and {block} tags is ignored as also stated in documentation.

You have to place the {debug} tag in the parent template.

Ok Thanks for the clarification (I am still fairly new to smarty Wink

IMHO {debug} should work as I stated as this creates a simple workflow where the current child template can be simply debugged without going all the way to the top of the hierarchy to turn on debugging, which is effectively the same as finding my custom smarty subclass and setting setDebugging(true).
This would turn out to be especially useful for smaller templates populated by php from AJAX calls.

Thanks again and I will put in a feature request for this although I know it is not a big one.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Thu Dec 01, 2011 1:23 pm    Post subject: Reply with quote

It can't be done as for template inheritance the child template source files are just containers where the source of child blocks is extracted from during compiling. Child templates are never executed just the resulting merged code of the parent template.
Back to top
View user's profile Send private message
CircleDev
Smarty Rookie


Joined: 27 Jul 2011
Posts: 7

PostPosted: Thu Dec 01, 2011 10:39 pm    Post subject: Reply with quote

U.Tews wrote:
It can't be done as for template inheritance the child template source files are just containers where the source of child blocks is extracted from during compiling. Child templates are never executed just the resulting merged code of the parent template.


Ok I see. Well it was worth a try. Thanks for the further clarification I feel like such a noob right now Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Bugs 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