codeigniter-twiggy icon indicating copy to clipboard operation
codeigniter-twiggy copied to clipboard

Loading wrong views when running other modules in HMVC

Open steve-goodwin opened this issue 10 years ago • 0 comments

When loading partials from other modules twiggy is using the path to my theme folder from the partial I'm trying to load from a category module and not my blog module. This results in the category create.html.twig template being loaded when calling my blog create.html.twig template.

$this->data['categories']   =   Modules::run('category/category_manage/dropdown');
$this->twiggy->set($this->data);
$this->twiggy->display();

I'm expecting the result to return the view from my category module to my blog module and allow this to be included to keep things DRY in my controllers and views.

The dropdown function in my categories controller is:

$this->data['categories']   =   $this->category_model->dropdown('id', 'name');
$this->twiggy->set($this->data);
$this->twiggy->template('dropdown')->display();

Please note I have also tried:

$this->data['categories']   =   $this->category_model->dropdown('id', 'name');
$this->twiggy->set($this->data);
return $this->twiggy->template('dropdown')->render();

and:

$this->data['categories']   =   $this->category_model->dropdown('id', 'name');
$this->twiggy->set($this->data);
$this->twiggy->template('dropdown')->render();

with no success

Debugging shows this message whilst calling 'blog/create':

Unable to find template "blog/create.html.twig" (looked into: application/../modules/category/themes/admin, application/themes/admin).

Which suggests the wrong theme location is being targetted when it should be looking in the current module 'blog' in 'themes/admin/blog/create.html.twig'

steve-goodwin avatar Mar 19 '14 09:03 steve-goodwin