Welcome Guest, Not a member yet? Register   Sign In
Flashdata and userdata in one function
#5

[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?


Messages In This Thread
Flashdata and userdata in one function - by El Forum - 10-29-2008, 01:24 PM
Flashdata and userdata in one function - by El Forum - 10-29-2008, 01:37 PM
Flashdata and userdata in one function - by El Forum - 10-29-2008, 01:49 PM
Flashdata and userdata in one function - by El Forum - 10-29-2008, 02:01 PM
Flashdata and userdata in one function - by El Forum - 10-29-2008, 02:23 PM
Flashdata and userdata in one function - by El Forum - 10-29-2008, 03:32 PM
Flashdata and userdata in one function - by El Forum - 10-29-2008, 08:30 PM
Flashdata and userdata in one function - by El Forum - 10-30-2008, 10:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB