Welcome Guest, Not a member yet? Register   Sign In
layouts Partial view and dynamic partial view problem
#1

[eluser]nevercode[/eluser]
Hello to everyone. I am a newbie in CI , good at php and OOP.

I am using layout library

Code:
<?php  
if (!defined('BASEPATH')) exit('No direct script access allowed');

class Layout
{
    
    var $obj;
    var $layout;
    
    function Layout($layout = "layout_main")
    {
        $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);
        }
    }
}
?>

everything is so far good so good. in my layout I can browse every controller. but I have category model.I want to use it as a sidebar.all categories codes are ok. when I load as $data in my main controller I can see all controller but in layout_main.php I cannot pass variable and show categories. the thing I want is header,footer,content(both 3 work fine) but I cant get categories working sidebar.. any help?

thank you.


Messages In This Thread
layouts Partial view and dynamic partial view problem - by El Forum - 10-13-2010, 03:57 AM
layouts Partial view and dynamic partial view problem - by El Forum - 10-13-2010, 07:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB