diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-01-03 20:14:06 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-01-03 20:14:06 +0000 |
commit | 3d9e5e439e63404159c1ef763c8b07dd15a367ec (patch) | |
tree | fe7483df1a468f1443f60bc154edeb3fecd29a1f /core/controllers | |
parent | 8ed5200101ac6feb48795b2fd8b2fb4a3462d45e (diff) |
Stay on the right page when we navigate up in the breadcrumb.
Introduce a "show" parameter which contains the id of the item that we
want to show when we go to the parent's page.
Diffstat (limited to 'core/controllers')
-rw-r--r-- | core/controllers/albums.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/controllers/albums.php b/core/controllers/albums.php index 668e868a..7f78303e 100644 --- a/core/controllers/albums.php +++ b/core/controllers/albums.php @@ -26,6 +26,18 @@ class Albums_Controller extends Items_Controller { access::required("view", $album); $page_size = module::get_var("core", "page_size", 9); + $show = $this->input->get("show"); + + if ($show) { + $index = $album->get_position($show); + $page = ceil($index / $page_size); + if ($page == 1) { + url::redirect("albums/$album->id"); + } else { + url::redirect("albums/$album->id?page=$page"); + } + } + $page = $this->input->get("page", "1"); $children_count = $album->viewable()->children_count(); $offset = ($page-1) * $page_size; |