我使用Smarty 3,并尝试使用参数扩展我的链接。
这可以很好地工作:
<a href="{$smarty.const.FILENAME_DEFAULT|xtc_href_link:'filter_license=1'}" class="btn btn-default btn-lg {if $smarty.get.filter_license == '1'}active{/if}">some text</a>但是,当我尝试用一个现有的$_GET参数扩展这个链接时,它导致了一个语法错误,我得到了一个白色页面。
<a href="{$smarty.const.FILENAME_DEFAULT|xtc_href_link:'cPath=$smarty.get.cPath&filter_license=1'}" class="btn btn-default btn-lg {if $smarty.get.filter_license == '1'}active{/if}">some text</a>$_GET参数类似于cPath=1_3
有没有其他方法可以在smarty中调用smarty变量?
发布于 2018-03-10 06:00:18
解决方案非常简单。我需要把参数放在双引号里,把聪明的调用放在反引号里,比如
<a href="{$smarty.const.FILENAME_DEFAULT|xtc_href_link:"cPath=`$smarty.get.cPath`&filter_license=1"}" class="btn btn-default btn-lg {if $smarty.get.filter_license == '1'}active{/if}">some text</a>https://stackoverflow.com/questions/49202268
复制相似问题