![](/img/trans.png)
[英]Why does my javascript not update quantity in Opencart category.tpl
[英]use multiple files in category.tpl with smarty
{$category->id|escape:'htmlall':'UTF-8'}
这个 smarty 代码用于获取 category.tpl 上的 id 号
我们有很多类别 id 的example 2,6,8,10
等,在我的文件夹中有很多文件名,例如2minimum.txt, 6minimum.txt, 8minimum.txt, 10minimum.txt
等
我想在当前类别 id 页面与类别 id 编号 txt 文件时使用包含文件。
{include file='folder/2minimum.txt'} <=-
当我输入文件名但我想这样使用时,这将完美无缺
{include file='folder/{$category->id|escape:'htmlall':'UTF-8'}minimum.txt'}
但它给出了错误
专家需要你帮助解决这个问题
您应该使用smarty cat
将变量连接到您的文件名。 在您的示例中,它应该类似于:
{include file='folder/'|cat:{$category->id|escape:'htmlall':'UTF-8'}|cat:'minimum.txt'}
希望对您有所帮助,祝您有美好的一天!
{include file='folder/'|cat:$category.id|cat:'minimum.txt'}
在 smarty {}
中表示{this is smarty}
。
但是你写了{this is smarty{what's this?}this is smarty}
。
这是一个语法错误。
而且我不确定,但我认为$category->id
是 php 代码样式。 您可以在 Prestashop 模板文件中发现$category.id
是 smarty 代码风格。
$category.id
返回数字。 我不认为它需要escape
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.