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

[eluser]toopay[/eluser]
replace this line
Code:
var_dump($this->uri->segment(3));
with
Code:
var_dump($CI->uri->segment(3));
#62

[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)
#63

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

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

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

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

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

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

[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
#70

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




Theme © iAndrew 2016 - Forum software by © MyBB