Welcome Guest, Not a member yet? Register   Sign In
VIEW WITHIN VIEW - CAN'T GET IT TO WORK
#1

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

header_view.php:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html xml:lang="en" lang="en"&gt;
    
&lt;head&gt;
    
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
    &lt;title&gt;&lt;?php echo $title; ?&gt; &lt;/title&gt;
    
    &lt;?php  echo $scripts; ?&gt;
    
&lt;/head&gt;

&lt;body&gt;
    
<div id="wrapper">

Controller:

Code:
&lt;?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


Messages In This Thread
VIEW WITHIN VIEW - CAN'T GET IT TO WORK - by El Forum - 10-23-2012, 08:36 PM
VIEW WITHIN VIEW - CAN'T GET IT TO WORK - by El Forum - 10-23-2012, 10:43 PM
VIEW WITHIN VIEW - CAN'T GET IT TO WORK - by El Forum - 10-24-2012, 12:36 AM
VIEW WITHIN VIEW - CAN'T GET IT TO WORK - by El Forum - 10-24-2012, 12:43 AM
VIEW WITHIN VIEW - CAN'T GET IT TO WORK - by El Forum - 10-24-2012, 06:19 AM
VIEW WITHIN VIEW - CAN'T GET IT TO WORK - by El Forum - 10-24-2012, 06:21 AM
VIEW WITHIN VIEW - CAN'T GET IT TO WORK - by El Forum - 10-24-2012, 06:23 AM
VIEW WITHIN VIEW - CAN'T GET IT TO WORK - by El Forum - 10-24-2012, 06:40 AM
VIEW WITHIN VIEW - CAN'T GET IT TO WORK - by El Forum - 10-24-2012, 07:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB