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

[eluser]TomTom[/eluser]
[quote author="Jérôme Jaglale" date="1246405206"]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');
[/quote]

This isn't working for me. My folders' structure is this:

Code:
root
- application
  - modules
    - blog
      - controllers
        - blog.php
      - views
        - blog.php
    - frontend
      - controllers
        - frontend.php
      - views
        - footer.php
        - header.php
        - main.php
        - sidebar.php
    - menu
      - controllers
        - menu.php
      - views
        - menu.php

I've added the required code to Template.php and this code to index method in my frontend.php:

Code:
$this->template->set('controller', $this);
$this->template->load_partial('main', 'menu');

When I load the Frontend's index method, I get the error message:

Quote:Unable to load the requested file: menu.php


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