Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ul class="pagination">
- {* small amount of pages *}
- {if $page_count <= 20}
- {*{section i in range(1,count_page)}*}
- {section name=item start=1 loop=$page_count+1 }
- <li {if $page_num eq $smarty.section.item.index } class="active" onclick="return false;"{/if}>
- <a href="{$base_uri}&page={$smarty.section.item.index}">{$smarty.section.item.index}</a>
- </li>
- {/section}
- {* many pages *}
- {else}
- {if $page_num >= 7}
- <li {if $page_num eq 1 } class="active" onclick="return false;"{/if}>
- <a href="{$base_uri}&page=1">1</a>
- </li>
- <li>
- <span>...</span>
- </li>
- {if $page_num > $page_count - 7}
- {*{section i in range($page_num - 5,$page_count)}*}
- {section name=item start=$page_num-4 loop=$page_count+1 }
- <li {if $page_num eq $smarty.section.item.index } class="active" onclick="return false;"{/if}>
- <a href="{$base_uri}&page={$smarty.section.item.index}">{$smarty.section.item.index}</a>
- </li>
- {/section}
- {else}
- {*{section i in range($page_num - 5,$page_num + 5)}*}
- {section name=item start=$page_num-4 loop=$page_num+6 }
- <li {if $page_num eq $smarty.section.item.index } class="active" onclick="return false;"{/if}>
- <a href="{$base_uri}&page={$smarty.section.item.index}">{$smarty.section.item.index}</a>
- </li>
- {/section}
- <li><span>...</span></li>
- <li {if $page_num eq $page_count } class="active" onclick="return false;"{/if}>
- <a href="{$base_uri}?page={$page_count}">{$page_count}</a>
- </li>
- {/if}
- {else}
- {*{section i in range(1,8)}*}
- {section name=item start=1 loop=8 }
- <li {if $page_num eq $smarty.section.item.index } class="active" onclick="return false;"{/if}>
- <a href="{$base_uri}&page={$smarty.section.item.index}">{$smarty.section.item.index}</a>
- </li>
- {/section}
- <li><span>...</span></li>
- {*{section i in range($page_count - 8,$page_count)}*}
- {section name=item start=$page_count-7 loop=$page_count+1 }
- <li {if $page_num eq $smarty.section.item.index } class="active" onclick="return false;"{/if}>
- <a href="{$base_uri}&page={$smarty.section.item.index}">{$smarty.section.item.index}</a>
- </li>
- {/section}
- {/if}
- {/if}
- </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement