CodeIgniter Forums

Full Version: Edit Page Issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8

El Forum

[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

El Forum

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

El Forum

[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

El Forum

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

El Forum

[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);
    
    }

El Forum

[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);
    }

El Forum

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

El Forum

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

El Forum

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

El Forum

[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']);
Pages: 1 2 3 4 5 6 7 8