From 974f9f778891bbefeb083b2d97b3dae206c96452 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 26 Nov 2008 21:50:45 +0000 Subject: Add a new "tag" page type. Create the concept of "page types" which let us specify the kind of page that we're rendering in high level terms. Currently there are three page types: album, photo and tag. The tag page type uses slightly different variables. It has a $tag but no $item. Adjust all sidebar_block() functions to avoid printing stuff that's dependent on the item if there is no item. Simplify the tag code to stop trying to fake an item. Update the theme slightly to use $item and $tag where appropriate (notably, for making the element). --- core/controllers/albums.php | 1 + core/controllers/photos.php | 1 + core/libraries/Theme.php | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/controllers/albums.php b/core/controllers/albums.php index f9e0be2c..4c117ac4 100644 --- a/core/controllers/albums.php +++ b/core/controllers/albums.php @@ -32,6 +32,7 @@ class Albums_Controller extends Items_Controller { $page = $this->input->get("page", "1"); $theme = new Theme($theme_name, $template); + $template->set_global("page_type", "album"); $template->set_global('page_size', $page_size); $template->set_global('item', $item); $template->set_global('children', $item->children($page_size, ($page-1) * $page_size)); diff --git a/core/controllers/photos.php b/core/controllers/photos.php index 1d995de8..2020aad3 100644 --- a/core/controllers/photos.php +++ b/core/controllers/photos.php @@ -28,6 +28,7 @@ class Photos_Controller extends Items_Controller { // @todo: this needs to be data-driven $theme = new Theme("default", $template); + $template->set_global("page_type", "photo"); $template->set_global('item', $item); $template->set_global('children', $item->children()); $template->set_global('parents', $item->parents()); diff --git a/core/libraries/Theme.php b/core/libraries/Theme.php index 315261a5..6ae08a4b 100644 --- a/core/libraries/Theme.php +++ b/core/libraries/Theme.php @@ -42,7 +42,7 @@ class Theme_Core { $this->pagination = new Pagination(); $this->pagination->initialize( array('query_string' => 'page', - 'total_items' => $this->template->item->children_count(), + 'total_items' => $this->template->children_count, 'items_per_page' => $this->template->page_size, 'style' => 'classic')); return $this->pagination->render(); @@ -64,6 +64,8 @@ class Theme_Core { case "album_top": case "album_blocks": case "album_bottom": + case "tag_top": + case "tag_bottom": case "thumbnail_top": case "thumbnail_bottom": case "thumbnail_info": -- cgit v1.2.3