Skip to content

Instantly share code, notes, and snippets.

@ymhuang0808
Last active August 29, 2015 14:05
Show Gist options
  • Save ymhuang0808/b0c23c27a749b29227a8 to your computer and use it in GitHub Desktop.
Save ymhuang0808/b0c23c27a749b29227a8 to your computer and use it in GitHub Desktop.
controller/admin.php
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Base_Controller extends CI_Controller
{
public function index()
{
// ignore
$this->_render_view('admin_view', '狗寶');
}
public function g1()
{
$this->_render_view('g1_view', '大一');
}
private function _render_view($main_view, $title, $main_data = array())
{
$header = array('title' => $title . ' - Tabo', 'user_display_name' => $display_name, 'page' => $this->uri->segment(2));
$this->load->view('header_view', $header);
if (empty($main_data)) {
$this->load->view($main_view);
}
else {
$this->load->view($main_view, $main_data);
}
$this->load->view('footer_view');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment