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

[eluser]jzmwebdevelopement[/eluser]
In my main question the mvc belongs to the editpage.php, I have also included the admintemplate as well when I access domain.co.nz/editpage.php witch gives me a textarea box with a submit button, but soon as I try to pass the "page" param to edit for example 'home' I get the 500 server error & the PHP Fatal error
#42

[eluser]toopay[/eluser]
Another unlear information. Why the uri like 'domain.co.nz/editpage.php'? In CI's Uri, it should be just 'domain.co.nz/editpage' right? Is 'editpage.php' a distribute of a single php file, which load CI app?

How is your (whole) app structure like? Give me a cascade structure of your app...
#43

[eluser]jzmwebdevelopement[/eluser]
Structure

I have

controllers:

home.php -> is the main controller for the front end of the site

admin -> sub folder

http://cl.ly/1r2J3G3g1K0u1T3H0j0z

controllers END

Models

http://cl.ly/451x0c121U3C1K2e1o00

Views

http://cl.ly/1F3o3T1r3q1q2c0i0I0P

Template -> main view template

templates -> main view page view content
#44

[eluser]toopay[/eluser]
Can you post the editpage controller?
#45

[eluser]jzmwebdevelopement[/eluser]
Code:
function index(){
        if($this->session->userdata('logged_in')){
        
        }else{
            redirect('admin/home');
        }
       $page = $this->navigation_model->getCMSPage($this->uri->segment(3));
        $data['cms_pages'] = $this->navigation_model->getCMSPages();
        $data['title'] = $page->name;
        $data['content'] = $this->load->view('admin/editpage', array('page' => $page, TRUE));

        $this->load->view('admintemplate', $data);
    
    }
#46

[eluser]toopay[/eluser]
modify you model
Code:
//...
    function getCMSPage($permalink = NULL)
    {
        if(!$permalink) $permalink = 'home'; //Default Page
        $query = $this->db->where('permalink', $permalink)
                          ->get('pages');
        $res = $query->result_array();
        return count($res)>0 ? $res[0] : 'No result';
    }
then in your controller
Code:
//...
    function index(){
        if(!$this->session->userdata('logged_in'))redirect('admin/home');
        // Just to ensure
        $CI =& get_instance();
        $CI->load->model('navigation_model');
        $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);
    }
#47

[eluser]jzmwebdevelopement[/eluser]
I will do when I get to class will report back
#48

[eluser]toopay[/eluser]
[quote author="jzmwebdevelopement" date="1303254561"]I will do when I get to class will report back[/quote]

Oh boy. Are you in school?
#49

[eluser]jzmwebdevelopement[/eluser]
I am under 4 weeks away from completing a diploma in web development and this is my final project were we had to build a custom cms. I have tried what you said and i am still getting the Fatal error.
#50

[eluser]jzmwebdevelopement[/eluser]
Also have you noted in my original question in my form view that I am using:

Code:
echo form_open('admin/editpage/'.$page->permalink, $formpageEdit);

Code:
$page =  $this->navigation_model->getCMSPage($this->uri->segment(3));

the content is then passed through the view and the editable content is passed into an array which is called in the view by using

Code:
echo form_textarea("content", $page['content']);




Theme © iAndrew 2016 - Forum software by © MyBB