2015-06-10 31 views
0

我试图让expressionengine检查一个单词的通道字段,如果找到该单词,它将显示另一个字段的内容。ExpressioneEngine包含运算符不起作用

在这种情况下,我希望它为“志愿者”一词搜索{links-title},如果找到“Volunteer”这个词,它会显示{links-branch}的内容。

这里是我想要使用的代码:

{exp:channel:entries channel="locations-links"} 
{if links-title *= "Volunteer"} 
{links-branch} 
{/if} 
{/exp:channel:entries} 

本页面:https://ellislab.com/expressionengine/user-guide/templates/conditionals.html#contains-operator说,包含运营商* =但是当我使用它时,页面显示完全空白。从字面上看,这个操作员似乎不起作用。如果我使用==它可行,但在这种情况下,{links-title}必须完全是“志愿者”,没有别的。

任何人都知道这是怎么回事?

+0

在[EE 2.9]中添加了“contains”运算符(https://ellislab.com/expressionengine/user-guide/about/changelog.html#version-2-9-0) 。你正在运行什么版本? – AllInOne

回答

0

您应该通过expressionengine.stackexchange.com实际询问您的问题。无论如何,你用什么版本的EE?在更新的版本中,条件的处理方式发生了很大变化,您正在使用最新版本的EE中的文档。如果你的网站没有运行EE 2.10,你最好参考你正在使用的版本的文档

0

有时你必须在变量名称周围放置花括号。试试这个:

{exp:channel:entries channel="locations-links"} 
{if "{links-title}" *= "Volunteer"} 
{links-branch} 
{/if} 
{/exp:channel:entries}