【问题标题】:how to add php code in .tpl type of file in cs-cart如何在cs-cart中的.tpl类型文件中添加php代码
【发布时间】:2011-08-04 01:59:54
【问题描述】:

谁能告诉我如何在 .tpl 文件中添加 php 代码,例如我想添加以下代码,但它不起作用

{php}
    if(isset($_GET['redirect']) && $_GET['redirect']=='clipboard'){

    echo '<input type="hidden" name="check" value="redirect" />' ;

 } 
 else{

     echo '<input type="hidden" name="check" value="notredirect" />' ;
 }

{/php}

【问题讨论】:

  • 没有理由从模板中读取$_GET

标签: php cs-cart


【解决方案1】:

我认为你想要的是这样的:

<input type="hidden" name="check" value="{if $smarty.get.redirect != "clipboard"}not{/if}redirect" />

【讨论】:

    【解决方案2】:

    你必须设置:

    'allow_php_in_templates' => true, // Allow to use {php} tags in templates
    

    在您的config.local.php 中,然后它就会起作用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-24
      • 2018-10-09
      • 1970-01-01
      相关资源
      最近更新 更多