使用 {pagination_links} 标签时,新闻部分的分页似乎出现了一个添加 /index/ 的问题。
我的新闻页面模板路径为 news/index,文章模板为 news/post。
我正在使用 structure,将 news/post 作为列表附加到 news/index 页面中,以添加|编辑文章。
如果您查看以下网站:http://www.wilbyltd.co.uk/news 向下滚动到底部,您将看到分页,如果单击 1 | 2 | 3 或下一页或最后一页,您将得到所请求的页面,URL 看起来像 /news/P6,但是在这个下一页上,如果您再次转到分页并单击其中任何一个,您将注意到它又回到了第一页,URL 变成了 /news/index,它似乎在链接之间添加或插入了 /index/。
我尝试在渠道条目中使用 paginate_base="",但添加基础会使类别的分页无法正常工作,类别还会在链接之间添加 /index/?
我曾经考虑过修改核心,但这似乎并不是正确的方法,以防它被更新。
我尝试使用 .htaccess 删除索引,但没有起作用。
RewriteRule ^/news/index/(.+)$ /news/$1 [L]
我查看了已经取消的index.php的配置,并使用了.htaccess。
我查看了渠道设置。
我尝试过dynamic="off"|dynamic="on"。
我知道news/index是正确的页面路径,但如果是这样的话,为什么它不能拾取分页?
如果有人能给出一些建议,我将不胜感激。这里是包含分页代码的代码。
{exp:channel:entries channel="posts" limit="6" dynamic="on" paginate="bottom" orderby="entry_date" sort="desc"}
<div class="news-snippet span9">
<a href="{url_title_path=">
<div class="date-published textalign-center">
<span class="day">{entry_date format="%d"}</span><span class="day-suffix">{entry_date format="%S"}</span>
<span class="month">{entry_date format="%F"}</span>
</div>
</a>
<div class="news-snippet-body pull-right">
<div class="news-snippet-top-shadow">
<div class="news-snippet-bottom-shadow">
<a href="{url_title_path=">
<div class="news-snippet-content clearfix">
<div class="title">
<h3>{title}</h3>
</div>
{if news_feature_image}
<div class="clearfix image">
<img src="{news_feature_image}" />
</div>
{/if}
<p>{news_short_description}</p>
</div><!-- end content -->
</a>
<div class="news-snippet-options clearfix">
<div class="news-tags pull-left">
<i class="icon-tags"></i>
{exp:tagger:tags entry_id="{entry_id}" }
<a href="/news/tags/{tagger:urlsafe_tagname}" title="{tagger:tag_name}"><span class="label label-inverse tags">{tagger:tag_name}</span></a>
{/exp:tagger:tags}
</div>
<div class="social-share pull-right textalign-center">
<i class="icon-random"></i>
<a class="addthis_button"url="{url_title_path="title="{title}" href="http://www.addthis.com/bookmark.php?v=300&pubid=ra-5141a60a37fa6e4e">Share</a>
</div>
</div>
</div><!-- end bottom-shadow -->
</div><!-- end top-shadow -->
</div><!-- end snippet-body -->
</div><!-- end news-snippet -->
{paginate}
<div class="clearfix paginate">
{pagination_links}
<div class="total-pages pull-left">
<p>Page {current_page} of {total_pages} pages</p>
</div>
<div class="pagination pagination-mini pull-right">
<ul>
{first_page}
<li><a href="{pagination_url}" class="page-first">First Page</a></li>
{/first_page}
{previous_page}
<li><a href="{pagination_url}" class="page-previous">Previous Page</a></li>
{/previous_page}
{page}
<li><a href="{pagination_url}" class="page-{pagination_page_number} {if current_page}active{/if}">{pagination_page_number}</a></li>
{/page}
{next_page}
<li><a href="{pagination_url}" class="page-next">Next Page</a></li>
{/next_page}
{last_page}
<li><a href="{pagination_url}" class="page-last">Last Page</a></li>
{/last_page}
</ul>
</div>
{/pagination_links}
</div><!-- end clearfix -->
{/paginate}
{/exp:channel:entries}
我在 Ellis Labs 论坛上也发表了几周: http://ellislab.com/forums/viewthread/237601/