[eluser]Barwick[/eluser]
Hey guys,
But of a CI newbie here, so trying to figure out the small sh*t that's probably super simple.
I'm trying to create some clean code and structure for my application. I have a header_view that I've posted below. But instead of layout out all the js and css scripts in this view, I wanted to point to another from the controller - a view within a view. I've read numerous posts on here and couldn't figure it out.
What am I doing wrong? I have a variable in the header_view below called $scripts. In my controller, I'm trying to pass through the scripts_view to the variable in my header...I'm assuming I'm not doing something right in controller (which I've also pasted below).
Note, I don't want to use a template system. Just want an organized application.
header_view.php:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php echo $title; ?> </title>
<?php echo $scripts; ?>
</head>
<body>
<div id="wrapper">
Controller:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Dashboard extends CI_Controller{
function __construct(){
parent::__construct();
$this -> load -> model('user_model');
}
public function index()
{
$session = $this->session->userdata('logged_in');
if ($session == 1)
{
$data['title'] = 'Dashboard';
$data['scripts'] = $this -> load -> view('scripts_view');
$this -> load -> view('shared/header_view', $data);
$this -> load -> view('dash', $data);
$this -> load -> view('shared/footer_view', $data);
}
else {
redirect('register');
}
}
}
Any help would be greatly appreciated boys and girls! love the framework so far - but still trying to hammer it down!
Cheers,
Mike