原生分页 带前后省略号判断
作者:互联网
{if ($page_list.page['sum']>1) AND ($page_list.page['sum']>=$page_list.page['page'])}
<div class="turn_pagination">
{volist name="page_list" id="page_number" }
<div class="turn_ul">
{gt name="$page_number['page']" value="1"}
<div class="turn_previous">上一页</div>
{/gt}
{if $page_number['sum']<10 AND $page_number['sum']>1}
<div {eq name="$page_number['page']" value="1" } class="active" {else
/}class="turn_li"{/eq}>1
</div>
{if $page_number['sum']>2 }
<div {eq name="$page_number['page']" value="2" } class="active" {else
/}class="turn_li"{/eq}>2
</div>
{/if}
{if $page_number['sum']>3}
<div {eq name="$page_number['page']" value="3" } class="active" {else/}class="turn_li"{/eq}>3</div>
{/if}
{if $page_number['sum']>4}
<div {eq name="$page_number['page']" value="4" } class="active" {else/}class="turn_li"{/eq}>4</div>
{/if}
{if $page_number['sum']>5}
<div {eq name="$page_number['page']" value="5" } class="active" {else/}class="turn_li"{/eq}>5</div>
{/if}
{if $page_number['sum']>6}
<div {eq name="$page_number['page']" value="6" } class="active" {else/}class="turn_li"{/eq}>6</div>
{/if}
{if $page_number['sum']>7}
<div {eq name="$page_number['page']" value="7" } class="active" {else/}class="turn_li"{/eq}>7</div>
{/if}
{if $page_number['sum']>8}
<div {eq name="$page_number['page']" value="8" } class="active" {else/}class="turn_li"{/eq}>8</div>
{/if}
{/if}
{if $page_number['sum']==10 }
<div {eq name="$page_number['page']" value="1" } class="active" {else/}class="turn_li"{/eq}>1</div>
{if $page_number['page']>3 }
<div class="turn_point">...</div>
{else/}
<div {eq name="$page_number['page']" value="2" } class="active" {else/}class="turn_li"{/eq}>2</div>
{/if}
<div {eq name="$page_number['page']" value="3" } class="active" {else/}class="turn_li"{/eq}>3</div>
<div {eq name="$page_number['page']" value="4" } class="active" {else/}class="turn_li"{/eq}>4</div>
<div {eq name="$page_number['page']" value="5" } class="active" {else/}class="turn_li"{/eq}>5</div>
<div {eq name="$page_number['page']" value="6" } class="active" {else/}class="turn_li"{/eq}>6</div>
<div {eq name="$page_number['page']" value="7" } class="active" {else/}class="turn_li"{/eq}>7</div>
<div {eq name="$page_number['page']" value="8" } class="active" {else/}class="turn_li"{/eq}>8</div>
{if $page_number['page']>3 }
<div {eq name="$page_number['page']" value="9" } class="active" {else/}class="turn_li"{/eq}>9</div>
{else/}
<div class="turn_point">...</div>
{/if}
{/if}
{if $page_number['sum']>10 AND $page_number['page']<4}
<div {eq name="$page_number['page']" value="1" } class="active" {else/}class="turn_li"{/eq}>1</div>
<div {eq name="$page_number['page']" value="2" } class="active" {else/}class="turn_li"{/eq}>2</div>
<div {eq name="$page_number['page']" value="3" } class="active" {else/}class="turn_li"{/eq}>3</div>
<div class="turn_li">4</div>
<div class="turn_li">5</div>
<div class="turn_li">6</div>
<div class="turn_li">7</div>
<div class="turn_li">8</div>
<div class="turn_point">...</div>
{elseif $page_number['sum']>10 AND $page_number['sum']-$page_number['page']<=7 /}
<div class="turn_li">1</div>
<div class="turn_point">...</div>
<div {eq name="$page_number['page']" value="$page_number['sum']-7" } class="active"
{else/}class="turn_li"{/eq}>{$page_number['sum']-7}</div>
<div {eq name="$page_number['page']" value="$page_number['sum']-6" } class="active"
{else/}class="turn_li"{/eq}>{$page_number['sum']-6}</div>
<div {eq name="$page_number['page']" value="$page_number['sum']-5" } class="active"
{else/}class="turn_li"{/eq}>{$page_number['sum']-5}</div>
<div {eq name="$page_number['page']" value="$page_number['sum']-4" } class="active"
{else/}class="turn_li"{/eq}>{$page_number['sum']-4}</div>
<div {eq name="$page_number['page']" value="$page_number['sum']-3" } class="active"
{else/}class="turn_li"{/eq}>{$page_number['sum']-3}</div>
<div {eq name="$page_number['page']" value="$page_number['sum']-2" } class="active"
{else/}class="turn_li"{/eq}>{$page_number['sum']-2}</div>
<div {eq name="$page_number['page']" value="$page_number['sum']-1" } class="active"
{else/}class="turn_li"{/eq}>{$page_number['sum']-1}</div>
{elseif $page_number['sum']>10 AND $page_number['sum']-$page_number['page']>7 /}
<div class="turn_li">1</div>
<div class="turn_point">...</div>
<div class="turn_li">{$page_number['page']-1}</div>
<div class="active">{$page_number['page']}</div>
<div class="turn_li">{$page_number['page']+1}</div>
<div class="turn_li">{$page_number['page']+2}</div>
<div class="turn_li">{$page_number['page']+3}</div>
<div class="turn_li">{$page_number['page']+4}</div>
<div class="turn_li">{$page_number['page']+5}</div>
<div class="turn_point">...</div>
{/if}
{if ( $page_number['sum']>1) AND ( $page_number['sum']==$page_number['page'])}
<div class="active">{$page_number['sum']}</div>
{else/}
<div class="turn_li">{$page_number['sum']}</div>
{/if}
{gt name="page_number['sum']" value="$page_number['page']"}
<div class="turn_next">下一页</div>
{/gt}
<div class="turn_text">共{$page_number['sum']}页</div>
<div class="turn_text">到第</div>
<div class="turn_input">
<input type="text"/>
</div>
<div class="turn_text">页</div>
<div class="turn_ensure">确定</div>
</div>
{if ($page_list.page['sum']>1) AND ($page_list.page['sum']>=$page_list.page['page'])} <div class="turn_pagination"> {volist name="page_list" id="page_number" } <div class="turn_ul"> {gt name="$page_number['page']" value="1"} <div class="turn_previous">上一页</div> {/gt} {if $page_number['sum']<10 AND $page_number['sum']>1} <div {eq name="$page_number['page']" value="1" } class="active" {else /}class="turn_li"{/eq}>1 </div> {if $page_number['sum']>2 } <div {eq name="$page_number['page']" value="2" } class="active" {else /}class="turn_li"{/eq}>2 </div> {/if} {if $page_number['sum']>3} <div {eq name="$page_number['page']" value="3" } class="active" {else/}class="turn_li"{/eq}>3</div> {/if} {if $page_number['sum']>4} <div {eq name="$page_number['page']" value="4" } class="active" {else/}class="turn_li"{/eq}>4</div> {/if} {if $page_number['sum']>5} <div {eq name="$page_number['page']" value="5" } class="active" {else/}class="turn_li"{/eq}>5</div> {/if} {if $page_number['sum']>6} <div {eq name="$page_number['page']" value="6" } class="active" {else/}class="turn_li"{/eq}>6</div> {/if} {if $page_number['sum']>7} <div {eq name="$page_number['page']" value="7" } class="active" {else/}class="turn_li"{/eq}>7</div> {/if} {if $page_number['sum']>8} <div {eq name="$page_number['page']" value="8" } class="active" {else/}class="turn_li"{/eq}>8</div> {/if} {/if} {if $page_number['sum']==10 } <div {eq name="$page_number['page']" value="1" } class="active" {else/}class="turn_li"{/eq}>1</div> {if $page_number['page']>3 } <div class="turn_point">...</div> {else/} <div {eq name="$page_number['page']" value="2" } class="active" {else/}class="turn_li"{/eq}>2</div> {/if} <div {eq name="$page_number['page']" value="3" } class="active" {else/}class="turn_li"{/eq}>3</div> <div {eq name="$page_number['page']" value="4" } class="active" {else/}class="turn_li"{/eq}>4</div> <div {eq name="$page_number['page']" value="5" } class="active" {else/}class="turn_li"{/eq}>5</div> <div {eq name="$page_number['page']" value="6" } class="active" {else/}class="turn_li"{/eq}>6</div> <div {eq name="$page_number['page']" value="7" } class="active" {else/}class="turn_li"{/eq}>7</div> <div {eq name="$page_number['page']" value="8" } class="active" {else/}class="turn_li"{/eq}>8</div> {if $page_number['page']>3 } <div {eq name="$page_number['page']" value="9" } class="active" {else/}class="turn_li"{/eq}>9</div> {else/} <div class="turn_point">...</div> {/if} {/if} {if $page_number['sum']>10 AND $page_number['page']<4} <div {eq name="$page_number['page']" value="1" } class="active" {else/}class="turn_li"{/eq}>1</div> <div {eq name="$page_number['page']" value="2" } class="active" {else/}class="turn_li"{/eq}>2</div> <div {eq name="$page_number['page']" value="3" } class="active" {else/}class="turn_li"{/eq}>3</div> <div class="turn_li">4</div> <div class="turn_li">5</div> <div class="turn_li">6</div> <div class="turn_li">7</div> <div class="turn_li">8</div> <div class="turn_point">...</div> {elseif $page_number['sum']>10 AND $page_number['sum']-$page_number['page']<=7 /} <div class="turn_li">1</div> <div class="turn_point">...</div> <div {eq name="$page_number['page']" value="$page_number['sum']-7" } class="active" {else/}class="turn_li"{/eq}>{$page_number['sum']-7}</div> <div {eq name="$page_number['page']" value="$page_number['sum']-6" } class="active" {else/}class="turn_li"{/eq}>{$page_number['sum']-6}</div> <div {eq name="$page_number['page']" value="$page_number['sum']-5" } class="active" {else/}class="turn_li"{/eq}>{$page_number['sum']-5}</div> <div {eq name="$page_number['page']" value="$page_number['sum']-4" } class="active" {else/}class="turn_li"{/eq}>{$page_number['sum']-4}</div> <div {eq name="$page_number['page']" value="$page_number['sum']-3" } class="active" {else/}class="turn_li"{/eq}>{$page_number['sum']-3}</div> <div {eq name="$page_number['page']" value="$page_number['sum']-2" } class="active" {else/}class="turn_li"{/eq}>{$page_number['sum']-2}</div> <div {eq name="$page_number['page']" value="$page_number['sum']-1" } class="active" {else/}class="turn_li"{/eq}>{$page_number['sum']-1}</div> {elseif $page_number['sum']>10 AND $page_number['sum']-$page_number['page']>7 /} <div class="turn_li">1</div> <div class="turn_point">...</div> <div class="turn_li">{$page_number['page']-1}</div> <div class="active">{$page_number['page']}</div> <div class="turn_li">{$page_number['page']+1}</div> <div class="turn_li">{$page_number['page']+2}</div> <div class="turn_li">{$page_number['page']+3}</div> <div class="turn_li">{$page_number['page']+4}</div> <div class="turn_li">{$page_number['page']+5}</div> <div class="turn_point">...</div> {/if} {if ( $page_number['sum']>1) AND ( $page_number['sum']==$page_number['page'])} <div class="active">{$page_number['sum']}</div> {else/} <div class="turn_li">{$page_number['sum']}</div> {/if} {gt name="page_number['sum']" value="$page_number['page']"} <div class="turn_next">下一页</div> {/gt} <div class="turn_text">共{$page_number['sum']}页</div> <div class="turn_text">到第</div> <div class="turn_input"> <input type="text"/> </div> <div class="turn_text">页</div> <div class="turn_ensure">确定</div> </div> {/volist} </div> {/if}
{/volist}
</div>
{/if}
标签:原生,...,分页,省略号,sum,number,else,eq,page 来源: https://www.cnblogs.com/dy-gf/p/16382449.html