|
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 |
raghu810 Smarty Rookie
Joined: 24 Apr 2015 Posts: 15
|
Posted: Mon Mar 21, 2016 9:43 pm Post subject: Why constant does not work with strip? |
|
|
I would like to enable or disable `{strip}` on a template file, but either case with constant or variable, its not working.
on my php file:
Code: | <?php
define("enablestrip",false); //enable/disable {strip} |
On a template file:
Code: | {if $smarty.const.enablestrip eq true}{strip}{/if}
<....content....>
{if $smarty.const.enablestrip eq true}{/strip}{/if} |
I have defined constant as false but still `{strip}` works. What am I doing wrong? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Mon Mar 21, 2016 10:38 pm Post subject: |
|
|
What you are doing wrong? Everything.
You're using Smarty wrong to begin with.
Rewrite your templates to use different inheritance chain, at the very least.
Or register postprocessing filter as needed. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Mar 23, 2016 11:00 pm Post subject: |
|
|
{strip}{/strip} is a special compiler tag. It can't be disabled at run time by {if}.
Also in general you can't put block tags like {foo} {/foo} in if conditions like you did. |
|
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
|