|
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 |
StratoKyke Smarty Rookie
Joined: 30 Apr 2015 Posts: 9
|
Posted: Wed Jul 29, 2015 4:22 pm Post subject: Show a piece of code only in a specific template |
|
|
I'll explain my problem:
This is my template:
Code: |
{include file="header.tpl" title="" page_description="" page_keywords=""}
{include file="leftSide.tpl"}
code of template
{include file="rightSide.tpl"}
{include file="footer.tpl"}
|
I Wish I could add a piece of code in the template: leftSide.tpl visible only when I open this template.
How could I do? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Jul 30, 2015 12:34 am Post subject: |
|
|
Again you missed the point!!!!
You can pass a flag when calling leftSide.tpl
Code: | {include file="leftSide.tpl" foo=true} |
In lestSide.tpl
Code: | {if isset($foo)}
...
{/if} |
|
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Jul 30, 2015 9:54 am Post subject: |
|
|
I'm not missing the point, I'm offering a viable and transparent alternative.
If I only need a specific code added to template, I would NOT pile cases upon cases, which someone after my death would need to track down and replace one by one. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Jul 30, 2015 2:15 pm Post subject: |
|
|
What does that mean. He does not use template inheritance at all. The {extends} tag does define parent child relation in template inheritance and is no different a different method.
I can't see how this can solve his problem that he needs to know in a subtemplate if it was called from from a certain main templem at all. |
|
Back to top |
|
StratoKyke Smarty Rookie
Joined: 30 Apr 2015 Posts: 9
|
Posted: Thu Jul 30, 2015 2:30 pm Post subject: |
|
|
Thank you so much U.Tews I solved the problem. |
|
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
|