Custom Routes and ability to edit page OR use a layout

Goal: I have a page that has some text at the top and at the bottom is a PHP gallery that is pulled from a model and database. I want the user to be able to edit the text at the top and not have the ability to change the PHP code for displaying the picture gallery.

Option #1 ) I've created a custom route.. it's currently at "/accommodations/historyexhibit" and references the "historyexhibit " controller which loads a custom view.. This works. I have a custom controller and view and it loads BUT my customer can't edit the text on that page. I have tried to put " echo fuel_var('body', '') " in the view and it did not work with the CMS...

How do I combine the ability to use controller to pull data and ALLOW the user to edit the text on that page??

route:
$route['Accommodations/History-Exhibit'] = 'historyexhibit';


controller:

class HistoryExhibit extends CI_Controller {

function __construct()
{
parent::__construct();
}

function index()
{
$this->load->library('session');

$vars = "";
// code will go here for pulling data for the gallery (not the issue right now)

$page_init = array('location' => 'historyexhibit');
$this->load->module_library(FUEL_FOLDER, 'fuel_page', $page_init);
$this->fuel_page->add_variables($vars);
$this->fuel_page->render();
}

}


view:
<?php echo fuel_var('body', ''); ?>

<?php echo "PHP test"; ?>



Again, I want to have a view that pulls a picture gallery from a database using a module in the controller.. I've already done this with other galleries but my customer can't edit the text on those pages... That's the problem, is that they can't change the text there. How do I do this???

Comments

  • edited 7:54PM
    Try adding this to the $page_init:
    $page_init = array('location' => 'historyexhibit', 'render_mode' => 'cms');
Sign In or Register to comment.