Smarty PHP add an {if} statement and include a tpl

124 views Asked by At

I am currently using Smarty-php for the first time, I am struggling however with placing a if statement around the {include} below.

{include './header.tpl'}

Everytime I do the following I get a 500 error.

{if $smarty.get.special is not "ajax"}
    {include './header.tpl'}
{/if}
1

There are 1 answers

0
axiac On BEST ANSWER

It should be:

{if $smarty.get.special != "ajax"}
    {include file='./header.tpl'}
{/if}

The is [not] syntax can be used to check if a value is (or is not) even or odd.