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). --- modules/tag/controllers/tags.php | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'modules/tag/controllers') diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php index 6011179a..db5f93bd 100644 --- a/modules/tag/controllers/tags.php +++ b/modules/tag/controllers/tags.php @@ -20,31 +20,40 @@ class Tags_Controller extends REST_Controller { protected $resource_type = "tag"; - /** - * @see Rest_Controller::_index() - */ + public function _show($tag) { + // @todo: these need to be pulled from the database + $theme_name = "default"; + $page_size = 9; + + $template = new View("page.html"); + + $page = $this->input->get("page", "1"); + $theme = new Theme($theme_name, $template); + + $template->set_global("page_type", "tag"); + $template->set_global('page_size', $page_size); + $template->set_global('tag', $tag); + $template->set_global('children', $tag->items($page_size, ($page-1) * $page_size)); + $template->set_global('children_count', $tag->count); + $template->set_global('theme', $theme); + $template->set_global('user', Session::instance()->get('user', null)); + $template->content = new View("tag.html"); + + print $template; + } + public function _index() { throw new Exception("@todo Tag_Controller::_index NOT IMPLEMENTED"); } - /** - * @see Rest_Controller::_form_add($parameters) - */ public function _form_add($parameters) { throw new Exception("@todo Tag_Controller::_form NOT IMPLEMENTED"); } - /** - * @see Rest_Controller::_form_edit($resource) - */ public function _form_edit($tag) { throw new Exception("@todo Tag_Controller::_form NOT IMPLEMENTED"); } - public function _show($tag) { - Albums_Controller::_show($tag); - } - public function _create($tag) { throw new Exception("@todo Tag_Controller::_create NOT IMPLEMENTED"); } -- cgit v1.2.3