[eluser]explores[/eluser]
Hi,
I am new to CI and I am trying to figure out how to setup certain pages to use a different layout, for example some pages will use a one column and others will use a two column structure. Currently I have a layout.php in the libraries folder and its set to read a layout.php in the views folder which works fine but when I try to repeat the process for the other layout I get an error message. I have searched the wiki, forum, guide, and Google but nothing I read seems like the correct solution.
Any help would be great
Thanks
ERROR
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Port::$layout
Filename: controllers/port.php
Line Number: 15
libraries Folder:
File: Layout_one_column
CODE:
Code:
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Layout_one_column
{
var $obj;
var $layout;
function Layout($layout = "layout_one_column")
{
$this->obj =& get_instance();
$this->layout = $layout;
}
function setLayout($layout)
{
$this->layout = $layout;
}
function view($view, $data=null, $return=false)
{
$loadedData = array();
$loadedData['content_for_layout'] = $this->obj->load->view($view,$data,true);
if($return)
{
$output = $this->obj->load->view($this->layout, $loadedData, true);
return $output;
}
else
{
$this->obj->load->view($this->layout, $loadedData, false);
}
}
}
?>
Controllers Folder:
File: port.php
Code:
Code:
<?php
class Port extends Controller
{
function Port()
{
parent::Controller();
$this->load->helper('url');
}
function index()
{
$data['title_for_layout'] = "Website Portfolio | Florida Web Design Company | Last 7 Studios";
$this->load->library('Layout_one_column','layout_one_column');
$this->layout->view('/port/port_view', $data);
}
}
?>