summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-12-31 07:22:35 +0000
committerBharat Mediratta <bharat@menalto.com>2008-12-31 07:22:35 +0000
commitfc56ebd4346b1e4515388ec8570f26deea7fd500 (patch)
tree7fe58e733a087b934c2a3aefc02076edd6724844
parent77bb22a65c64bd5bae1a304051e1e19bd3993b52 (diff)
Simplify the next/previous logic in the theme by passing in a null
next/prev sib if one didn't exist. (that's what we were supposed to be doing in the first place, anyway)
-rw-r--r--core/controllers/photos.php4
-rw-r--r--themes/default/views/photo.html.php5
2 files changed, 5 insertions, 4 deletions
diff --git a/core/controllers/photos.php b/core/controllers/photos.php
index 82f9b779..d59ce26d 100644
--- a/core/controllers/photos.php
+++ b/core/controllers/photos.php
@@ -49,8 +49,8 @@ class Photos_Controller extends Items_Controller {
$template->set_global("children", array());
$template->set_global("children_count", $photo->children_count());
$template->set_global("parents", $photo->parents());
- $template->set_global("next_item", $next_item);
- $template->set_global("previous_item", $previous_item);
+ $template->set_global("next_item", $next_item->loaded ? $next_item : null);
+ $template->set_global("previous_item", $previous_item->loaded ? $previous_item : null);
$template->set_global("sibling_count", $photo->parent()->children_count());
$template->set_global("position", $position);
diff --git a/themes/default/views/photo.html.php b/themes/default/views/photo.html.php
index d23dec2d..9af66c35 100644
--- a/themes/default/views/photo.html.php
+++ b/themes/default/views/photo.html.php
@@ -13,12 +13,13 @@
<?= $theme->photo_bottom() ?>
</div>
-<? if ($position > 1): ?>
+<? if ($previous_item): ?>
<a href="<?= $previous_item->url() ?>"><?= _("previous") ?></a>
<? endif ?>
+
<?= sprintf(_("Viewing photo %d of %d"), $position, $sibling_count) ?>
-<? if ($position < $sibling_count): ?>
+<? if ($next_item): ?>
<a href="<?= $next_item->url() ?>"><?= _("next") ?></a>
<? endif ?>