1
0

add 'first' & 'last' navigation buttons for item pages. code inspired from GreyDragon Wind theme

This commit is contained in:
mamouneyya 2010-08-21 11:35:18 +08:00 committed by Bharat Mediratta
parent d6dc5f6b7a
commit b4a451b089

View File

@ -26,6 +26,23 @@
//
?>
<?
// @mamouneyya
// in order to add 'first' & 'last' navigation buttons for item pages. code inspired from GreyDragon Wind theme
if ($page_type == "item"): {
if ($item):
$parent = $item->parent();
endif;
$current_page = $position;
$total_pages = $total;
$siblings = $item->parent()->children();
for ($i = 1; $i <= $total; $i++):
$_pagelist[$i] = $siblings[$i-1]->url();
endfor;
}
endif;
?>
<ul class="g-paginator ui-helper-clearfix">
<li class="g-first">
<? if ($page_type == "collection"): ?>
@ -37,6 +54,16 @@
<span class="ui-icon ui-icon-seek-first"></span><?= t("First") ?></a>
<? endif ?>
<? endif ?>
<? if ($page_type == "item"): ?>
<? if ($current_page > 1): ?>
<a href="<?= $_pagelist[1] ?>" class="g-button ui-icon-left ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-seek-first"></span><?= t("First") ?></a>
<? else: ?>
<a class="g-button ui-icon-left ui-state-disabled ui-corner-all">
<span class="ui-icon ui-icon-seek-first"></span><?= t("First") ?></a>
<? endif ?>
<? endif ?>
<? if (isset($previous_page_url)): ?>
<a href="<?= $previous_page_url ?>" class="g-button ui-icon-left ui-state-default ui-corner-all">
@ -83,5 +110,15 @@
<span class="ui-icon ui-icon-seek-end"></span><?= t("Last") ?></a>
<? endif ?>
<? endif ?>
<? if ($page_type == "item"): ?>
<? if ($current_page < $total_pages): ?>
<a href="<?= $_pagelist[$total_pages] ?>" class="g-button ui-icon-right ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-seek-end"></span><?= t("Last") ?></a>
<? else: ?>
<a class="g-button ui-state-disabled ui-icon-right ui-corner-all">
<span class="ui-icon ui-icon-seek-end"></span><?= t("Last") ?></a>
<? endif ?>
<? endif ?>
</li>
</ul>