易企cms建站仿站教程

分页

<ul class="pagination">
          {assign var="nextpage" value="`$curpage+1`"}
          {assign var="prepage" value="`$curpage-1`"}
          {if ($curpage > 1)}
          <li><a href="{formaturl type="category" siteurl=$siteurl name=$category->filename page=$prepage}">上一页</a> {/if}
            {if ($curpage < 6)}
            {section name=loop loop=$totalpage} 
            {assign var=id value=$smarty.section.loop.index+1}
            {if $id<6}
            {if $id==$curpage}
          <li class="active"><a class="now_page" style="cursor:default;" href="javascript:void(0);">{$id}</a></li>
          {else}
          <li><a href="{formaturl type="category" siteurl=$siteurl name=$category->filename page=$id}">{$id}</a></li>
          {/if}
          {/if}
          {/section}
          <li><a>...</a></li>
          <li><a href="{formaturl type="category" siteurl=$siteurl name=$category->filename page=$totalpage}">{$totalpage}</a></li>
          {/if}
          
          {assign var="p" value="`$totalpage-5`"}
          {if $curpage < $p && $curpage > 6}
          <li><a href="{formaturl type="category" siteurl=$siteurl name=$category->filename}">1</a></li>
          <li><a>...</a></li>
          {assign var="prepage" value="`$curpage-1`"}
          {assign var="nexpage" value="`$curpage+1`"}
          <li><a href="{formaturl type="category" siteurl=$siteurl name=$category->filename page=$prepage}">{$prepage}</a></li>
          <li class="active"><a class="now_page" style="cursor:default;" href="javascript:void(0);">{$curpage}</a></li>
          <li><a href="{formaturl type="category" siteurl=$siteurl name=$category->filename page=$nexpage}">{$nexpage}</a></li>
          <li><a>...</a></li>
          <li><a href="{formaturl type="category" siteurl=$siteurl name=$category->filename page=$totalpage}">{$totalpage}</a></li>
          {/if}
          
          {assign var="p" value="`$totalpage-6`"}
          {if $curpage < $totalpage+1 && $curpage > $p}
          <li><a href="{formaturl type="category" siteurl=$siteurl name=$category->filename}">1</a></li>
          <li><a>...</a></li>
          {section name=loop loop=$totalpage} 
          {assign var="p" value="`$totalpage-5`"}
          {assign var=id value=$smarty.section.loop.index+1}
          {if $p<=$id}
          {if $id==$curpage}
          <li class="active"><a class="now_page" style="cursor:default;" href="javascript:void(0);">{$id}</a></li>
          {else}
          <li><a href="{formaturl type="category" siteurl=$siteurl name=$category->filename page=$id}">{$id}</a></li>
          {/if}
          {/if}
          {/section}
          
          {/if}
          
          {assign var="prepage" value="`$curpage-1`"}
          {if ($curpage > 0) && ($curpage < $totalpage)}
          <li><a href="{formaturl type="category" siteurl=$siteurl name=$category->filename page=$nextpage}">下一页</a> </li>
          {/if}
        </ul>

评论

热度(1)