can anyone tell me how to add php code in .tpl file eg i want to add the following code but it didn't work
{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" />
You must set:
'allow_php_in_templates' => true, // Allow to use {php} tags in templates
in your config.local.php
, and then it will work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.