summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-11-07 07:33:43 +0000
committerBharat Mediratta <bharat@menalto.com>2008-11-07 07:33:43 +0000
commit76436c0029f5be153f805a1be03e17ea26309906 (patch)
tree2ac99106d2600c5de8518621a22cda8702598ff2 /themes
parent50a9848f383c988b720c99945fbb91f371e02fa0 (diff)
Add automatic pagination. All you have to do is add <?= $theme->pager
?> to your theme file and you get a well formed pager. Themes can customize this any way they want. A version that matches the mockup is provided in the default theme.
Diffstat (limited to 'themes')
-rw-r--r--themes/default/views/album.html.php8
-rw-r--r--themes/default/views/pager.html.php28
2 files changed, 29 insertions, 7 deletions
diff --git a/themes/default/views/album.html.php b/themes/default/views/album.html.php
index 0d181536..034c9a9e 100644
--- a/themes/default/views/album.html.php
+++ b/themes/default/views/album.html.php
@@ -27,10 +27,4 @@
<? endforeach ?>
</ul>
- <div id="gPagination">
- Items 1-10 of 34
- <span class="first_inactive">first</span>
- <span class="previous_inactive">previous</span>
- <a href="#" class="next">next</a>
- <a href="#" class="last">last</a>
- </div>
+ <?= $theme->pager() ?>
diff --git a/themes/default/views/pager.html.php b/themes/default/views/pager.html.php
new file mode 100644
index 00000000..bec06696
--- /dev/null
+++ b/themes/default/views/pager.html.php
@@ -0,0 +1,28 @@
+<? defined("SYSPATH") or die("No direct script access."); ?>
+<? // See http://docs.kohanaphp.com/libraries/pagination ?>
+<div id="gPagination">
+ <?= sprintf(_("Photos %d - %d of %d"), $current_first_item, $current_last_item, $total_items) ?>
+ <? if ($first_page): ?>
+ <a href="<?= str_replace('{page}', 1, $url) ?>"><?= _("first") ?></a>
+ <? else: ?>
+ <span class="first_inactive"><?= _("first") ?></span>
+ <? endif ?>
+
+ <? if ($previous_page): ?>
+ <a href="<?= str_replace('{page}', $previous_page, $url) ?>"><?= _("previous") ?></a>
+ <? else: ?>
+ <span class="previous_inactive"><?= _("previous") ?></span>
+ <? endif ?>
+
+ <? if ($next_page): ?>
+ <a href="<?= str_replace('{page}', $next_page, $url) ?>"><?= _("next") ?></a>
+ <? else: ?>
+ <span class="next_inactive"><?= _("next") ?></span>
+ <? endif ?>
+
+ <? if ($last_page): ?>
+ <a href="<?= str_replace('{page}', $last_page, $url) ?>"><?= _("last") ?></a>
+ <? else: ?>
+ <span class="last_inactive"><?= _("last") ?></span>
+ <? endif ?>
+</div>