Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Why constant does not work with strip?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
raghu810
Smarty Rookie


Joined: 24 Apr 2015
Posts: 15

PostPosted: Mon Mar 21, 2016 9:43 pm    Post subject: Why constant does not work with strip? Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Mon Mar 21, 2016 10:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Wed Mar 23, 2016 11:00 pm    Post subject: Reply with quote

{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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General 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