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]toopay[/eluser]
replace this line
Code:
var_dump($this->uri->segment(3));
with
Code:
var_dump($CI->uri->segment(3));

El Forum

[eluser]jzmwebdevelopement[/eluser]
That change has outputted the same line:
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)

El Forum

[eluser]toopay[/eluser]
Ok, this would be it.
Code:
//...
    function index(){
        if(!$this->session->userdata('logged_in'))redirect('admin/home');
        // Just to ensure
        $CI =& get_instance();
        $CI->load->model('navigation_model');
        // Check the uri segment first
        $permalink = $this->uri->segment(3) != FALSE ? $this->uri->segment(3) : 'home';
        $page = (array) $this->navigation_model->getCMSPage($permalink);
        $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);
    }
and change any $page->somekey in your view file to $page['some_key'], because you sent it in array not in object anymore.

El Forum

[eluser]jzmwebdevelopement[/eluser]
I have changed my view to the following:
Code:
<?php
//Setting form attributes
$formpageEdit = array('id' => 'pageEdit', 'name' => 'pageEdit');
$formInputTitle = array('id' => 'title', 'name' => 'title');
$formTextareaContent = array('id' => 'content', 'name' => 'content');
?>

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

but I still cannot pass the page param to be edited with out getting a fatal error.

El Forum

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

El Forum

[eluser]jzmwebdevelopement[/eluser]
No, I am still presented with that wonderful error, can't spot an error any where

El Forum

[eluser]toopay[/eluser]
Is there still Internal Server Error or reguler php error? If 500 error raised, try once again to use this .htaccess
Code:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?/$1 [L]
But make sure you clear your browser cache (if neccessary, restart your apache) before test it.

El Forum

[eluser]jzmwebdevelopement[/eluser]
The above .htaccess has broken the site completely by saying Oops! This link appears to be broken. The error is a PHP error.

El Forum

[eluser]toopay[/eluser]
Show your working htaccess configuration...

Coressponding with your consistent internal server error, the first thing that i think need to be fixed is your htaccess

El Forum

[eluser]jzmwebdevelopement[/eluser]
I was only getting the internal server error on my local mamp server -> maybe you have a point but it looked to me as it happend when there was a fatal php issue.

Working .htaccess
Code:
# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond $1 !^(index\.php|css|js|images|files|scripts|robots\.txt)
  RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>
Pages: 1 2 3 4 5 6 7 8