2015-06-10 66 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}