2011-06-04 80 views
1

我建立了一个网站,其中有八个通道,分为两个部分。ExpressionEngine中的导航和分页问题

其中一个部分被称为“文章”,在该部分有两个频道,“功能”和“新闻”。

一切工作都很好,直到我将分页引入到等式中。

在文章索引页,我有“最新”,“功能”和“新闻”标签,然后我通过他们,并选择条目导航基于段:

<ul id="tabs"> 
<li>{if segment_2 == ''}<strong>Latest</strong>{if:else}<a href="{site_url}articles/">Latest</a>{/if}</li> 
<li>{if segment_2 == 'features'}<strong>Features</strong>{if:else}<a href="{path=articles/features}">Features</a>{/if}</li>      
<li>{if segment_2 == 'news'}<strong>News</strong>{if:else}<a href="{path=articles/news}">News</a>{/if}</li> 
</ul> 
{if segment_2 == ''}{exp:channel:entries channel="features|news" limit="10" dynamic="no" order="date" paginate="both"}{/if} 
{if segment_2 == 'features'}{exp:channel:entries channel="features" limit="10" dynamic="no" order="date" paginate="both"}{/if}     
{if segment_2 == 'news'}{exp:channel:entries channel="news" limit="10" dynamic="no" order="date" paginate="both"}{/if} 

site.com/articles系统会显示所有条目
site.com/articles/features/的特点带来了所有条目通道
site.com/articles/news/在新闻频道带来了所有条目

这个伟大的工程,直到有一个拥有多个页面的频道等等将“P4”添加到URL中,然后{segment_2}中未筛选的索引变为P4,而不是我在导航通道条目时所做的操作。

分页网址: site.com/articles/P4

我想我的问题是这样的:

我是不是导航或正确过滤条目?如果是这样,我现在如何与分页?

谢谢!

回答

1

这里有两种可能的解决方案。

可以使用paginate_base参数明确地告诉EE分页参数之前,使用一个特定的路径:

{if segment_2 == 'features'}{exp:channel:entries channel="features" limit="10" dynamic="no" order="date" paginate="both" paginate_base="articles/features"}{/if}     
{if segment_2 == 'news'}{exp:channel:entries channel="news" limit="10" dynamic="no" order="date" paginate="both" paginate_base="articles/news"}{/if}` 

或者 - 和我的首选解决方案 - 是“文章”组下创建两个新模板,名为“新闻”和“特色”,并在那里列出你的参赛作品。您可以通过将标签导航(甚至您计划放置在channel:entries标签之间的标记/逻辑(如果它们对于每个部分相同)标记为snippets)来避免代码重复。

+0

我认为你的首选解决方案是要走的路。 – Tom 2011-06-07 14:55:09