SHARE
TWEET

Untitled

a guest Feb 12th, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <ul class="pagination">
  2.     {* small amount of pages *}
  3.     {if $page_count <= 20}
  4.         {*{section i in range(1,count_page)}*}
  5.         {section name=item start=1 loop=$page_count+1 }
  6.             <li {if $page_num eq $smarty.section.item.index } class="active" onclick="return false;"{/if}>
  7.                 <a href="{$base_uri}&page={$smarty.section.item.index}">{$smarty.section.item.index}</a>
  8.             </li>
  9.         {/section}
  10.         {* many pages *}
  11.  
  12.     {else}
  13.         {if $page_num >= 7}
  14.             <li {if $page_num eq 1 } class="active" onclick="return false;"{/if}>
  15.                 <a href="{$base_uri}&page=1">1</a>
  16.             </li>
  17.             <li>
  18.                 <span>...</span>
  19.             </li>
  20.             {if $page_num > $page_count - 7}
  21.                 {*{section i in range($page_num - 5,$page_count)}*}
  22.                 {section name=item start=$page_num-4 loop=$page_count+1 }
  23.                     <li {if $page_num eq $smarty.section.item.index } class="active" onclick="return false;"{/if}>
  24.                         <a href="{$base_uri}&page={$smarty.section.item.index}">{$smarty.section.item.index}</a>
  25.                     </li>
  26.                 {/section}
  27.             {else}
  28.                 {*{section i in range($page_num - 5,$page_num + 5)}*}
  29.                 {section name=item start=$page_num-4 loop=$page_num+6 }
  30.                     <li {if $page_num eq $smarty.section.item.index } class="active" onclick="return false;"{/if}>
  31.                         <a href="{$base_uri}&page={$smarty.section.item.index}">{$smarty.section.item.index}</a>
  32.                     </li>
  33.                 {/section}
  34.                 <li><span>...</span></li>
  35.                 <li {if $page_num eq $page_count } class="active" onclick="return false;"{/if}>
  36.                     <a href="{$base_uri}?page={$page_count}">{$page_count}</a>
  37.                 </li>
  38.             {/if}
  39.         {else}
  40.             {*{section i in range(1,8)}*}
  41.             {section name=item start=1 loop=8 }
  42.                 <li {if $page_num eq $smarty.section.item.index } class="active" onclick="return false;"{/if}>
  43.                     <a href="{$base_uri}&page={$smarty.section.item.index}">{$smarty.section.item.index}</a>
  44.                 </li>
  45.             {/section}
  46.             <li><span>...</span></li>
  47.             {*{section i in range($page_count - 8,$page_count)}*}
  48.             {section name=item start=$page_count-7 loop=$page_count+1 }
  49.                 <li {if $page_num eq $smarty.section.item.index } class="active" onclick="return false;"{/if}>
  50.                     <a href="{$base_uri}&page={$smarty.section.item.index}">{$smarty.section.item.index}</a>
  51.                 </li>
  52.             {/section}
  53.         {/if}
  54.     {/if}
  55. </ul>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top