2011-08-22 22 views
0

我需要一些循環表達式引擎條目的幫助。我在一個我一直在努力的網站上遇到了一堵磚牆。基本上該網站有6個最新的項目在底部,左側和右側有next和prev圖標。當你到達項目的結尾時,會回到項目的開始按鈕,將用戶帶回到項目的開始......呃,客戶端不再需要這些,只是希望項目有一個無限循環!循環表達式引擎條目?

這是可能與EE,是否有一個循環條目我可以使用的附加組件?

我的代碼是:

{exp:channel:next_entry category_group="1" category="{categories}{category_id}|{/categories}"} 
<a class="rightNav" href="{id_path='projects-test/view'}" style="color:#000;"><<</a> 
{/exp:channel:next_entry} 

{embed="projects-test/related" stop_before="{entry_date format="%Y-%m-%d %H:%i"}" category_id="{categories show_group="1" limit="1"}{category_id}{/categories}"} 

{exp:channel:prev_entry category_group="1" category="{categories}{category_id}|{/categories}"} 
<a class="leftNav" href="{id_path='projects-test/view'}" style="color:#000;">>></a> 
{/exp:channel:prev_entry} 

{/exp:channel:entries} 

相關模板代碼:

{exp:channel:entries channel="project" limit="6" category_group="1" stop_before="{embed:stop_before}" related_categories_mode="yes" custom_fields="yes"} 
{if count == "1"}<ul id="filmStrip">{/if} 
<li> 
{exp:imgsizer:size src="{project_image}" height="68px" width="137px"} 
<a href="{title_permalink='projects-test/view'}"><img src="{sized}" height="{height}" width="{width}" alt=""/></a> 
{/exp:imgsizer:size} 
<a href="{title_permalink='projects-test/view'}"><p class="thumbTitle">{title}</p></a> 
</li> 
{if count == total_results}</ul>{/if} 
{/exp:channel:entries} 
+0

表達式引擎並不經常出現在這裏,所以反應將是有限的。試試http://expressionengine.com/forums/ – adlawson

+0

不管你信不信,過去我在這裏比我的論壇有更多的幫助。他們的社區不是很有幫助。 –

+0

與EE一樣靈活和強大的系統的缺點之一是,聽起來像「循環條目」一樣簡單的事情實際上是非常棘手的,因爲沒有任何順序或限制任何條目列表。任何結果的順序和長度可以變化很大。 –

回答

0

This plugin可以爲你做的伎倆。

用法大概是這樣的:

{exp:bbr_prevnext_entry current_entry_id="{entry_id}" category="{categories}{category_id}|{/categories}" channel_name="project" orderby="entry_date" sort="desc" return_fields="entry_id" cycle="yes"} 
    <a class="rightNav" href="/projects-test/view/{next_entry_id}" style="color:#000;"><<</a> 
{/exp:bbr_prevnext_entry} 

{embed="projects-test/related" stop_before="{entry_date format="%Y-%m-%d %H:%i"}" category_id="{categories show_group="1" limit="1"}{category_id}{/categories}"} 

{exp:bbr_prevnext_entry current_entry_id="{entry_id}" category="{categories}{category_id}|{/categories}" channel_name="project" orderby="entry_date" sort="desc" return_fields="entry_id" cycle="yes"} 
    <a class="leftNav" href="/projects-test/view/{prev_entry_id}" style="color:#000;">>></a> 
{/exp:bbr_prevnext_entry} 
+0

嗨,試試吧。它不會工作,因爲它需要輸入current_entry_id。毫無意義的真的,如果它接受{entry_id}就沒問題,但是當我嘗試這個時它會拋出一個錯誤。它也不支持「category =」和「category_group =」在一起... –

+0

我敢肯定,您使用'current_entry_id =「{entry_id}」'(或'{embed:entry_id}'您的情況) 。你永遠不需要同時使用category和category_group,因爲category總是會覆蓋category_group。 但不管 - 再看一遍,這個插件不適合你的具體目的。這意味着更多的使用**下一個條目**和**上一個條目**鏈接在單個條目頁面上。 –

+0

其實,它應該......我在答案中爲你添加了一個代碼示例。 –