1
回答
PublicCMS-分页
【阿里云】新一代云服务器,9元体验半年,限时领取!>>>   
在publicCMS上如何实现分页
举报
wzy_
发帖于7个月前 1回/337阅

静态化页面分页可以参考

http://www.publiccms.com/demonstrate/index_2.html

<#if page??>
	<div class="page">
		<#if !page.firstPage>
			<a href="${getPage(url,page.prePage)}">上一页</a>
		<#else>
			<span>上一页</span>
		</#if>
		<#assign start=1/>
		<#if (page.pageIndex-5) gt start>
			<#assign start=page.pageIndex-4/>
		</#if>
		<#assign end=page.totalPage/>
		<#if (page.pageIndex+5) lt end>
			<#assign end=page.pageIndex+4/>
		</#if>
		<#if start gt 1>
			<a href="${getPage(url,1)}">1</a> ...
		</#if>
		<#list start..end as n><a href="${getPage(url,n)}"<#if n=page.pageIndex> class="selected"</#if>>${n}</a></#list>
		<#if end lt page.totalPage>
			... <a href="${getPage(url,page.totalPage)}">${page.totalPage}</a>
		</#if>
		<#if !page.lastPage>
			<a href="${getPage(url,page.nextPage)}">下一页</a>
		<#else>
			<span>下一页</span>
		</#if>
	</div>
</#if>



动态页面分页可以参考 http://search.publiccms.com/?word=%E6%8E%A5%E5%8F%A3

<#if page??>
	<div class="page">
		<#if !page.firstPage>
			<a href="?word=${(word?url)!}&tagId=${(tagId?url)!}&page=${page.prePage}">上一页</a>
		<#else>
			<span>上一页</span>
		</#if>
		<#assign start=1/>
		<#if (page.pageIndex-5) gt start>
			<#assign start=page.pageIndex-4/>
		</#if>
		<#assign end=page.totalPage/>
		<#if (page.pageIndex+5) lt end>
			<#assign end=page.pageIndex+4/>
		</#if>
		<#if start gt 1>
			<a href="?word=${(word?url)!}&tagId=${(tagId?url)!}&page=1">1</a> ...
		</#if>
		<#list start..end as n><a href="?word=${(word?url)!}&tagId=${(tagId?url)!}&page=${n}"<#if n=page.pageIndex> class="selected"</#if>>${n}</a></#list>
		<#if end lt page.totalPage>
			... <a href="?word=${(word?url)!}&tagId=${(tagId?url)!}&page=${page.totalPage}">${page.totalPage}</a>
		</#if>
		<#if !page.lastPage>
			<a href="?word=${(word?url)!}&tagId=${(tagId?url)!}&page=${page.nextPage}">下一页</a>
		<#else>
			<span>下一页</span>
		</#if>
	</div>
</#if>



顶部