Welcome Guest, Not a member yet? Register   Sign In
loading menu for all controllers ?
#7

[eluser]jwindhorst[/eluser]
Here's the way I handle the header/footer issue. I first create a custom_functions_helper.php file in the helpers directory. Inside there I create this function:
Code:
function load_view_with_templates($views, $header_data=array())
    {
        // determine which layout we are using
        list($layout, $header_data['nav_style']) = explode("_", LAYOUT);
        $header_data['layout'] = $layout;

        $CI =& get_instance();
        $CI->load->view("/layout/header",$header_data);

        if(is_array($views))
            foreach($views AS $v=>$d)
                $CI->load->view("/layout/$layout/views/$v", $d);
        else
            $CI->load->view("/layout/$layout/views/$views", $header_data);

        $CI->load->view("/layout/footer");
    }

Then in my controllers, instead of calling the normal
Code:
$this->load->view('view_name);

I call:
Code:
load_view_with_templates($views, $data);

The views parameter can be an array, so if you needed to load multiple views between your header and footer that would also work fine.

Hope it helps.


Messages In This Thread
loading menu for all controllers ? - by El Forum - 11-27-2009, 01:24 AM
loading menu for all controllers ? - by El Forum - 11-27-2009, 03:40 AM
loading menu for all controllers ? - by El Forum - 11-27-2009, 05:14 AM
loading menu for all controllers ? - by El Forum - 11-27-2009, 08:19 AM
loading menu for all controllers ? - by El Forum - 11-27-2009, 08:20 AM
loading menu for all controllers ? - by El Forum - 11-27-2009, 02:00 PM
loading menu for all controllers ? - by El Forum - 12-18-2009, 03:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB