rosuandreimihai rosuandreimihai - 1 year ago 171
Smarty Question

Prestashop smarty {if} statement

I have a problem regarding a simple statement in prestashop's smarty tpl file
I am trying to restrict access for some html code using a if statement, just like the one below:

{if $page_name != 'cms' || $page_name != 'module-checkout-payment' || $page_name != 'countrypages' || $page_name != 'dpage'}
/* stuff here */

The code above doesn't work, but if I only use one condition it will work, just like this:

{if $page_name != 'cms'}
/* stuff here */

I still don't get it, what is wrong.. Could someone help me?
Thank you..

Answer Source

I think you are using the wrong operator. With the OR operator your code will fire even if $page_name is some of your restricted values. Try with '&&' instead of '||'.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download