|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
sergeda Smarty n00b
Joined: 26 May 2012 Posts: 4
|
Posted: Wed Sep 05, 2012 11:50 am Post subject: block inside if? |
|
|
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 |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Sep 05, 2012 3:36 pm Post subject: |
|
|
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 |
|
sergeda Smarty n00b
Joined: 26 May 2012 Posts: 4
|
Posted: Thu Sep 06, 2012 5:45 am Post subject: Will wait |
|
|
Thank you for information will wait for next version. |
|
Back to top |
|
|
|
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
|