public function action_index($id) { $page = Model_Page::getBySlug($id, false); if (!$page || !$page->isPublished() && !Helper_Account::is_admin(Auth::instance()->get_user())) { $this->template->content = View::factory("errors/index"); return; } $this->template->content = View::factory("page/index")->set("page", $page); $this->template->sidebar = Widget::factory()->add(Helper_Default::sidebar()); }
public function action_page($slug) { $page = Model_Page::getBySlug($slug, false); if ($page) { $this->template->content = View::factory("myshot/index"); $this->template->content->page = $page; $this->template->sidebar = Widget::factory()->add(Helper_Default::sidebar()); } else { $this->template->content = "No page available"; //redirect instead? } }