本文介绍了您将如何在Twig的{%%}内部执行三元条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想呈现参数(如果存在的话),但是找不到正确显示它并保持获取
的方法。打开的括号未正确关闭。
I want to render parameters if they exist but can't find a way of correctly displaying it and keep getting An opened parenthesis is not properly closed. Unexpected token "punctuation" of value ":" ("punctuation" expected with value ")")
其中
{% setcontent records = 'properties' where
{filter:search_term,
((classification) ? ('classification':classification):(''))
} printquery %}
推荐答案
要在 Bolt CMS
中使用它,请先定义您的选项,然后将其传递给 Bolt CMS
To use it inside Bolt CMS
, first define your options and then pass that to Bolt CMS
{% set options = { filter: search_term , } %}
{% if classification is defined and classification|trim != '' %}
{% set options = options|merge({classification:classification,}) %}
{% endif %}
{% setcontent records = 'properties' where options printquery %}
这篇关于您将如何在Twig的{%%}内部执行三元条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!