Twig 未捕获的细枝“U错误”语法:未知;json_encode";函数opencart
我的opencart 3.0.2.0 webshop中的细枝文件有问题。我得到的错误是: 未捕获的细枝错误语法:中未知的“json编码”函数 第22行的“default/template/extension/module/notification.twig”。在里面 /home/mk4design/public_html/system/library/template/Twig/ExpressionParser.php:574 堆栈跟踪:#0 下面是完整的细枝文件,有3行带有Twig 未捕获的细枝“U错误”语法:未知;json_encode";函数opencart,twig,opencart-3,Twig,Opencart 3,我的opencart 3.0.2.0 webshop中的细枝文件有问题。我得到的错误是: 未捕获的细枝错误语法:中未知的“json编码”函数 第22行的“default/template/extension/module/notification.twig”。在里面 /home/mk4design/public_html/system/library/template/Twig/ExpressionParser.php:574 堆栈跟踪:#0 下面是完整的细枝文件,有3行带有json\u enc
json\u encode
的代码不正确
谁能帮我给我一个解决这个问题的线索吗
<div id="fnotification-{{ module }}" class="f-notification animated">
<div class="notification-block">
{% if (notification['close_status']) %}<button class="fclose-notification">×</button>{% endif %}
<div class="notification-image">
{% if (custom_icons) %}
{% if (thumb) %}
<img src="{{ thumb }}" title="{{ title }}" alt="{{ title }}">
{% endif %}
{% else %}
<i class="fas fa {{ font_icon }}"></i>
{% endif %}
</div>
<div class="notification-text-block">
<div class="notification-title">{{ title }}</div>
<div class="notification-text"></div>
</div>
</div>
</div>
<script type="text/javascript">
$('#fnotification-{{ module }}').fNotification({
uId : {{ module }},
Cities : {{ json_encode(city) }},
Names : {{ json_encode(cname) }},
Products : {{ json_encode(products) }},
Amount : [{{ min_amount }}, {{ max_amount }}],
Text : '{{ text }}',
// Time Duration
DelayFirstMin : '{{ delay_first }}',
DisplayTime : '{{ display_time }}',
DelayMin : '{{ delay_between }}',
AnimationEffectOpen : '{{ in_animation }}',
AnimationEffectClose : '{{ out_animation }}',
DisplayTimes : '{{ cutomer_session > 0 ? cutomer_session : 0 }}',
CloseLifetime : '{{ cookie_time }}',
// Position
position: '{{ position }}',
postionTop : {{ top != '' ? top : '' }},
postionBottom : '{{ bottom != '' ? bottom : '' }}',
postionLeft : '{{ left != '' ? left : '' }}',
postionRight : '{{ right != '' ? right : '' }}',
NotificationSound :'',
// Style
borderRadius : '{{ border_radius }}',
borderWidth : '{{ border_width }}',
borderColor : '{{ border_color }}',
backGround : '{{ bg_color }}',
TextColor : '{{ text_color }}',
LinkColor : '{{ link_color }}',
Width : '{{ popup_width }}',
Height : '{{ popup_height }}',
// Close Button Color
BtnCloseColor : '{{ close_color }}',
BtnCloseHoverColor : '{{ close_hover_color }}',
});
</script>
{%if(通知['close_status'])%}{%endif%}
{%if(自定义图标)%}
{%if(thumb)%}
{%endif%}
{%else%}
{%endif%}
{{title}}
$('#fnotification-{module}}')。fnotification({
uId:{{module}},
城市:{{json_encode(城市)},
名称:{{json_encode(cname)}},
产品:{{json_encode(产品)}},
金额:[{min\U Amount},{{max\U Amount}}],
文本:“{{Text}}”,
//持续时间
DelayFirstMin:{{delay_first}}},
DisplayTime:“{display_time}}”,
DelayMin:“{{delay_-between}}}”,
AnimationEffectOpen:“{{in_animation}}”,
AnimationEffectClose:“{{out_animation}}”,
显示时间:“{cutomer_会话>0?cutomer_会话:0}}”,
CloseLifetime:“{cookie_time}}”,
//位置
位置:“{position}}”,
postionTop:{{top!=''?top:'},
positionbottom:“{{bottom!=”?bottom:“}}”,
postionLeft:“{{left!=”?left:“}}”,
postionRight:“{{right!=”?right:“}}”,
通知声音:'',
//风格
边界半径:{{border_radius}}},
borderWidth:“{{border_width}}}”,
borderColor:{{border_color}}},
背景:{{bg_color}}},
TextColor:“{{text_color}}”,
LinkColor:“{{link_color}}”,
宽度:{{popup_Width}}},
高度:{{popup_Height}}},
//关闭按钮颜色
BtnCloseColor:“{{close_color}}”,
BtnCloseHoverColor:“{{close\u hover\u color}}”,
});
json的细枝语法是数据| json_encode()
json\u encode
不是默认的过滤器
/函数
。你必须把它加到树枝上
Just change:
Cities : {{ json_encode(city) }},
Names : {{ json_encode(cname) }},
Products : {{ json_encode(products) }},
To:
Cities : {{ city|json_encode() }},
Names : {{ cname|json_encode() }},
Products : {{ products|json_encode() }},