[eluser]CodeIgniterNoob[/eluser]
MAybe Im not presenting the question properly. All the functions have their views.
Index
Code:
function index()
{
$data['head_title'] = "Some title";
$data['pages'] = $this->MPages->getAllPages();
$data['cats'] = $this->MCats->getTopCategories();
$this->template->load('mainTemplate', 'pages_home', $data);
}
Edit Page
Code:
function edit($id=NULL)
{
if ($this->input->post('name'))
{
$this->MPages->updatePage();
$this->session->set_flashdata('message','Page Updated!');
redirect('admin/pages/index','refresh');
}
else
{
$id = $this->uri->segment(4);
if ($id=="")
{
redirect('admin/pages/index','refresh');
}
else
{
$data['head_title'] = "Edit Page";
$data['page'] = $this->MPages->getPage($id);
$cats = $this->MCats->getCategoriesNav();
$data['categories'] = $this->_flatten_cats($cats);
$this->template->load('mainTemplate', 'pages_edit', $data);
}
}
}
And heres the parent
Code:
function __construct()
{
parent::Controller();
$user_table = 'testusers';
if ($this->session->userdata('logged_in'))
{
echo 'Logged as'.$this->session->userdata('username');
}
else
{
redirect('welcome/login','refresh');
}
}
What am I doing wrong?