Welcome Guest, Not a member yet? Register   Sign In
HMVC and Layout Template Library
#2

[eluser]Jérôme Jaglale[/eluser]
In libraries/Template.php add:

Code:
function load_partial($template = '', $view = '' , $view_data = array(), $return = FALSE)
{
    $this->set('contents', $this->template_data['controller']->load->view($view, $view_data, TRUE));
    return $this->template_data['controller']->load->view($template, $this->template_data, $return);
}

In the controller:

Code:
$this->template->set('controller', $this);
$this->template->load_partial('home', 'partial');

Details: if I've understood correctly, HMVC makes the controller use a custom load->view() method, but without overriding load->view() from $this->CI. To make the Template library use the load->view() from HMVC we pass the controller and call load->view() on it.


Messages In This Thread
HMVC and Layout Template Library - by El Forum - 06-29-2009, 05:37 AM
HMVC and Layout Template Library - by El Forum - 06-30-2009, 04:40 PM
HMVC and Layout Template Library - by El Forum - 07-01-2009, 04:28 AM
HMVC and Layout Template Library - by El Forum - 07-11-2009, 10:14 AM
HMVC and Layout Template Library - by El Forum - 07-11-2009, 10:16 AM
HMVC and Layout Template Library - by El Forum - 07-18-2009, 04:32 AM
HMVC and Layout Template Library - by El Forum - 07-18-2009, 05:33 AM
HMVC and Layout Template Library - by El Forum - 07-20-2009, 08:34 PM
HMVC and Layout Template Library - by El Forum - 07-17-2010, 03:12 AM
HMVC and Layout Template Library - by El Forum - 06-10-2012, 02:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB