Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- application\core\MY_Controller.php
- <?php
- class MY_Controller extends CI_Controller {
- public function __construct()
- {
- parent::__construct();
- }
- final public function _render($view = 'content', $data = array())
- {
- $menu['top'] = $this->menu_model->get_top_menu();
- $menu['cats'] = $this->category_model->get_list();
- $menu['tags'] = $this->tag_model->get_list();
- $menu['last_comments'] = $this->comment_model->get_last(10);
- $menu['links'] = $this->link_model->get_list();
- $menu['month_pages'] = $this->page_model->get_month_list();
- $menu['top_pages'] = $this->page_model->get_top(10);
- $menu['top_comments'] = $this->comment_model->get_top(10);
- $this->load->view('header', $menu);
- $this->load->view($view, $data);
- $this->load->view('footer', $menu);
- }
- }
- application\controllers\page.php
- class Page extends MY_Controller {
- function __construct()
- {
- parent::__construct();
- }
- function index()
- {
- $data['page_title'] = 'Last 10 pages';
- $data['page_list'] = $this->page_model->get_list(10);
- $this->_render('content', $data);
- }
- function show($id = NULL)
- {
- $id = (int) $id;
- $data['page_title'] = 'Page #'.$id;
- $data['page'] = $this->page_model->get_page($id);
- $this->_render('page/show', $data);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement