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.
#2

[eluser]Shaun Andrews[/eluser]
I'm fairly new to CI, and have no experience with the Layout Library, but have used, and like, the Ocular Library (http://code.google.com/p/ocular/wiki/Introduction). It seems much more simple to use than what you have here. Give it a glance, and maybe you'll find it does what you need.

Hope I've helped.




Theme © iAndrew 2016 - Forum software by © MyBB