Welcome Guest, Not a member yet? Register   Sign In
Edit Page Issue
#51

[eluser]toopay[/eluser]
Is this generates error too?
Code:
//...
    function index(){
        if(!$this->session->userdata('logged_in'))redirect('admin/home');
        // Just to ensure
        $CI =& get_instance();
        $CI->load->model('navigation_model');
        var_dump($this->navigation_model->getCMSPage('home'));
        /*
        $page = $this->navigation_model->getCMSPage($this->uri->segment(3));
        $data['cms_pages'] = $this->navigation_model->getCMSPages();
        $data['title'] = $page['name'] ? $page['name'] : 'Something wrong';
        $data['content'] = $this->load->view('admin/editpage', array('page' => $page, TRUE));
        $this->load->view('admintemplate', $data);
        */
    }
#52

[eluser]jzmwebdevelopement[/eluser]
right we are now getting somewhere

when I used the above code and accessed domain.co.nz/editpage/

I got
Code:
object(stdClass)#23 (5) { ["id"]=> string(1) "1" ["name"]=> string(4) "Home" ["permalink"]=> string(4) "home" ["content"]=> string(21) "This is the home page" ["template"]=> string(4) "home" }

but when I tried to pass the "page" pram I still got the fatal error.
#53

[eluser]toopay[/eluser]
rename $page to something else!$mypage or whatever!
#54

[eluser]jzmwebdevelopement[/eluser]
I renamed $page to $mypage and I am still not able to pass the prama
#55

[eluser]toopay[/eluser]
Continue debug it... try this
Code:
//...
    function index(){
        if(!$this->session->userdata('logged_in'))redirect('admin/home');
        // Just to ensure
        $CI =& get_instance();
        $CI->load->model('navigation_model');
        $mypage = (array) $this->navigation_model->getCMSPage('home');
        var_dump($mypage);
        /*
        $page = $this->navigation_model->getCMSPage($this->uri->segment(3));
        $data['cms_pages'] = $this->navigation_model->getCMSPages();
        $data['title'] = $page['name'] ? $page['name'] : 'Something wrong';
        $data['content'] = $this->load->view('admin/editpage', array('page' => $page, TRUE));
        $this->load->view('admintemplate', $data);
        */
    }
#56

[eluser]jzmwebdevelopement[/eluser]
The above code outputted

Code:
array(5) { ["id"]=> string(1) "1" ["name"]=> string(4) "Home" ["permalink"]=> string(4) "home" ["content"]=> string(21) "This is the home page" ["template"]=> string(4) "home" }

I just cannot understand why I cannot pass the permalink and call the above data
#57

[eluser]toopay[/eluser]
Then debug it!
Code:
//...
    function getCMSPage($permalink = '')
    {
        $foo = $permalink != '' ? $permalink : 'home';
        $query = $this->db->where('permalink', $foo)
                          ->get('pages');
        $res = $query->result_array();
        return count($res)>0 ? $res[0] : 'No result';
    }
#58

[eluser]jzmwebdevelopement[/eluser]
ok,

The debug code above showed the homepage content in the text area under the editpage, but I am still getting the Fatal Error when I pass the correct param into the url
#59

[eluser]toopay[/eluser]
What this result...
Code:
//...
    function index(){
        if(!$this->session->userdata('logged_in'))redirect('admin/home');
        // Just to ensure
        $CI =& get_instance();
        $CI->load->model('navigation_model');
        $mypage = (array) $this->navigation_model->getCMSPage('home');
        var_dump($mypage);
        var_dump($this->uri->segment(3));
        /*
        $page = $this->navigation_model->getCMSPage($this->uri->segment(3));
        $data['cms_pages'] = $this->navigation_model->getCMSPages();
        $data['title'] = $page['name'] ? $page['name'] : 'Something wrong';
        $data['content'] = $this->load->view('admin/editpage', array('page' => $page, TRUE));
        $this->load->view('admintemplate', $data);
        */
    }
#60

[eluser]jzmwebdevelopement[/eluser]
Result is
Code:
array(5) { ["id"]=> string(1) "1" ["name"]=> string(4) "Home" ["permalink"]=> string(4) "home" ["content"]=> string(21) "This is the home page" ["template"]=> string(4) "home" } bool(false)




Theme © iAndrew 2016 - Forum software by © MyBB