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

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
sergeda
Smarty n00b


Joined: 26 May 2012
Posts: 4

PostPosted: Wed Sep 05, 2012 11:50 am    Post subject: block inside if? Reply with quote

Hi.
I'm trying to do this:
In layout template:
Code:
{block name=slogan}bla bla bla{/block}

Then in child template:
Code:
{if isset($page->slogan)&&!empty($page->slogan)}{block name=slogan}{$page->slogan}{/block}{/if}


So from this code it seems like if $page->slogan not set block shouldn't been owerwritten but it did. And I'm getting empty space were should be bla bla bla.
Have I missed something?
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Wed Sep 05, 2012 3:36 pm    Post subject: Reply with quote

Currently template inheritance is implemented as a compile time replacement of the {block} source content.
For that reason conditional statements like yours is not allowd in chiold templates and everything outside {block}...{/block} is ignored.
See http://www.smarty.net/docs/en/advanced.features.template.inheritance.tpl

We are working on render time template inheritance for the next major release 3.2 which will eliminate this restriction.
Back to top
View user's profile Send private message
sergeda
Smarty n00b


Joined: 26 May 2012
Posts: 4

PostPosted: Thu Sep 06, 2012 5:45 am    Post subject: Will wait Reply with quote

Thank you for information will wait for next version.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3 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