简体   繁体   English

Smarty PHP添加一个{if}语句并包含一个tpl

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

I am currently using Smarty-php for the first time, I am struggling however with placing a if statement around the {include} below. 我目前是第一次使用Smarty-php,但是我在下面的{include}周围放置了if语句,这很麻烦。

{include './header.tpl'}

Everytime I do the following I get a 500 error. 每次执行以下操作时,都会出现500错误。

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

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. is [not]语法可用于检查值是(还是不是)偶数或奇数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM