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

[eluser]jzmwebdevelopement[/eluser]
Hello,

I am getting the following error when I try and access:

domain.co.nz/admin/editpage/home

I get the following error:

Code:
PHP Fatal error:  Call to a member function getCMSPage() on a non-object in controllers/home.php on line 22



The issue with this is that I cannot understand why it is being passed back into the main "home" controller - which is the main controller

Ideal Situation

What I am trying to do with this is load the content into a text area on for editing and when submit is clicked I would like it to go back to the same page with a message saying content updated.

Admin Template

Code:
<li>&lt;?php echo anchor('#','Edit Pages');?&gt;
            &lt;?php if(is_array($cms_pages)): ?&gt;
                    <ul>
                        &lt;?php foreach($cms_pages as $page): ?&gt;
                        <li><a >permalink?&gt;">&lt;?=$page->name?&gt;</a></li>
                        &lt;?php endforeach; ?&gt;
                    </ul>
                &lt;?php endif; ?&gt;
                </li>

Page Model

Code:
function updatePage($data){
        $data = array('content' => $content);
        $this ->db->where('id',$id);
        $this->db->update('pages',$data);
    }

View:

Code:
&lt;?php
//Setting form attributes
$formpageEdit = array('id' => 'pageEdit', 'name' => 'pageEdit');
$formInputTitle = array('id' => 'title', 'name' => 'title');
$formTextareaContent = array('id' => 'content', 'name' => 'content');
?&gt;

<section id = "validation">&lt;?php echo validation_errors();?&gt;</section>

<h4>&lt;?= $title ?&gt; </h4>
&lt;?php
echo form_open('admin/editpage/'.$page->permalink, $formpageEdit);
echo form_fieldset();
echo form_label ('Content', 'content');
echo form_textarea("content", $page['content']);
echo form_submit('submit','Submit');
echo form_fieldset_close();
echo form_close();
?&gt;

Controller:

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


Messages In This Thread
Edit Page Issue - by El Forum - 04-18-2011, 06:42 PM
Edit Page Issue - by El Forum - 04-18-2011, 07:35 PM
Edit Page Issue - by El Forum - 04-18-2011, 07:37 PM
Edit Page Issue - by El Forum - 04-18-2011, 07:43 PM
Edit Page Issue - by El Forum - 04-18-2011, 07:45 PM
Edit Page Issue - by El Forum - 04-18-2011, 07:47 PM
Edit Page Issue - by El Forum - 04-18-2011, 07:58 PM
Edit Page Issue - by El Forum - 04-18-2011, 08:47 PM
Edit Page Issue - by El Forum - 04-18-2011, 08:51 PM
Edit Page Issue - by El Forum - 04-18-2011, 09:00 PM
Edit Page Issue - by El Forum - 04-18-2011, 09:04 PM
Edit Page Issue - by El Forum - 04-18-2011, 09:14 PM
Edit Page Issue - by El Forum - 04-18-2011, 09:21 PM
Edit Page Issue - by El Forum - 04-18-2011, 09:39 PM
Edit Page Issue - by El Forum - 04-18-2011, 09:45 PM
Edit Page Issue - by El Forum - 04-18-2011, 09:54 PM
Edit Page Issue - by El Forum - 04-18-2011, 09:57 PM
Edit Page Issue - by El Forum - 04-18-2011, 10:11 PM
Edit Page Issue - by El Forum - 04-18-2011, 10:16 PM
Edit Page Issue - by El Forum - 04-18-2011, 10:24 PM
Edit Page Issue - by El Forum - 04-18-2011, 10:26 PM
Edit Page Issue - by El Forum - 04-18-2011, 11:04 PM
Edit Page Issue - by El Forum - 04-18-2011, 11:08 PM
Edit Page Issue - by El Forum - 04-18-2011, 11:12 PM
Edit Page Issue - by El Forum - 04-18-2011, 11:20 PM
Edit Page Issue - by El Forum - 04-18-2011, 11:37 PM
Edit Page Issue - by El Forum - 04-18-2011, 11:40 PM
Edit Page Issue - by El Forum - 04-18-2011, 11:51 PM
Edit Page Issue - by El Forum - 04-18-2011, 11:58 PM
Edit Page Issue - by El Forum - 04-19-2011, 12:07 AM
Edit Page Issue - by El Forum - 04-19-2011, 12:15 AM
Edit Page Issue - by El Forum - 04-19-2011, 12:29 AM
Edit Page Issue - by El Forum - 04-19-2011, 12:34 AM
Edit Page Issue - by El Forum - 04-19-2011, 12:48 AM
Edit Page Issue - by El Forum - 04-19-2011, 12:56 AM
Edit Page Issue - by El Forum - 04-19-2011, 01:09 AM
Edit Page Issue - by El Forum - 04-19-2011, 01:18 AM
Edit Page Issue - by El Forum - 04-19-2011, 01:26 AM
Edit Page Issue - by El Forum - 04-19-2011, 01:32 AM
Edit Page Issue - by El Forum - 04-19-2011, 01:41 AM
Edit Page Issue - by El Forum - 04-19-2011, 02:05 AM
Edit Page Issue - by El Forum - 04-19-2011, 02:13 AM
Edit Page Issue - by El Forum - 04-19-2011, 02:21 AM
Edit Page Issue - by El Forum - 04-19-2011, 03:30 AM
Edit Page Issue - by El Forum - 04-19-2011, 11:40 AM
Edit Page Issue - by El Forum - 04-19-2011, 12:06 PM
Edit Page Issue - by El Forum - 04-19-2011, 12:09 PM
Edit Page Issue - by El Forum - 04-19-2011, 12:12 PM
Edit Page Issue - by El Forum - 04-19-2011, 02:22 PM
Edit Page Issue - by El Forum - 04-19-2011, 02:36 PM
Edit Page Issue - by El Forum - 04-19-2011, 02:50 PM
Edit Page Issue - by El Forum - 04-19-2011, 02:55 PM
Edit Page Issue - by El Forum - 04-19-2011, 02:58 PM
Edit Page Issue - by El Forum - 04-19-2011, 03:01 PM
Edit Page Issue - by El Forum - 04-19-2011, 03:05 PM
Edit Page Issue - by El Forum - 04-19-2011, 03:08 PM
Edit Page Issue - by El Forum - 04-19-2011, 03:14 PM
Edit Page Issue - by El Forum - 04-19-2011, 03:18 PM
Edit Page Issue - by El Forum - 04-19-2011, 03:28 PM
Edit Page Issue - by El Forum - 04-19-2011, 03:30 PM
Edit Page Issue - by El Forum - 04-19-2011, 03:34 PM
Edit Page Issue - by El Forum - 04-19-2011, 03:37 PM
Edit Page Issue - by El Forum - 04-19-2011, 03:45 PM
Edit Page Issue - by El Forum - 04-19-2011, 03:50 PM
Edit Page Issue - by El Forum - 04-19-2011, 04:00 PM
Edit Page Issue - by El Forum - 04-19-2011, 04:05 PM
Edit Page Issue - by El Forum - 04-19-2011, 04:11 PM
Edit Page Issue - by El Forum - 04-19-2011, 04:21 PM
Edit Page Issue - by El Forum - 04-20-2011, 01:44 AM
Edit Page Issue - by El Forum - 04-20-2011, 01:49 AM
Edit Page Issue - by El Forum - 04-20-2011, 01:56 AM
Edit Page Issue - by El Forum - 04-20-2011, 02:01 AM
Edit Page Issue - by El Forum - 04-20-2011, 02:04 AM
Edit Page Issue - by El Forum - 04-20-2011, 02:07 AM
Edit Page Issue - by El Forum - 04-20-2011, 02:09 AM
Edit Page Issue - by El Forum - 04-20-2011, 02:16 AM
Edit Page Issue - by El Forum - 04-20-2011, 02:17 AM
Edit Page Issue - by El Forum - 04-20-2011, 02:21 AM
Edit Page Issue - by El Forum - 04-20-2011, 05:33 AM
Edit Page Issue - by El Forum - 04-20-2011, 11:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB