簡體   English   中英

如何在cs-cart中以.tpl類型的文件添加php代碼

[英]how to add php code in .tpl type of file in cs-cart

誰能告訴我如何在.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}

我認為您想要的是:

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

您必須設置:

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

在您的config.local.php ,然后它將起作用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM