I use the same template library as the fil sturgeon, and I have the following layout for my control panel. I get this error. I ran var_dump in the template variable inside the control panel controller, and it showed the control panel view line, but when I do the same inside the content view, it says that there was no body index. I would like to know how to pass data to a content view.
Any ideas for me?
Severity: Notice Message: Undefined index: body Filename: partials/content.php Line Number: 8
Control panel controller
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Controlpanel extends Backend_Controller { public function __construct() { parent::__construct(); } public function index() { $this->template ->title('Control Panel') ->set_layout('controlpanel') ->set_partial('header', 'partials/header') ->set_partial('sidebar', 'partials/sidebar') ->set_partial('breadcrumbs', 'partials/breadcrumbs') ->set_partial('content', 'partials/content') ->set('user_data', $this->users_model->get($this->session->userdata('uid'))) ->build('dashboard'); } }
content.php
<div id="content"> <?php echo $template['partials']['breadcrumbs']; ?> <div class="separator bottom"></div> <?php echo $template['body']; ?> </div>
I tried to study this and still have not found a solution. I was hoping someone else would see something that I did not know.
source share