Вопрос

I'm using codeigniter 2.1.3 with wiredesignz HMVC, I was wondering how would I get templates from the public folder rather than the modules/module/views?

example structure

application/projects/projectname/ciappstructure

application/system/etc/

public/themes/themename/layout

public/themes/themename/pages

public/themes/themename/widgets

public/themes/themename/etc

I would love to use html files and have my template library sort out the tags and placement of widgets or modules, all modules and theme data being pulled from the DB

like: $homepage = $this->load->view(FCPATH.'themes/$theme/pages/homepage.html', $data, TRUE);

Oh and another quick question, I'm new to HMVC, could I call modules::run('module/method', $params, $...); from a template library (/application/projects/project/libraries/template.php) ?

I've tried a few things but I can't seem to get anything working, any ideas are much appreciated! Thanks in advance

Это было полезно?

Решение

First, the $this->load->view() load views with .php extension not .html files, Second, this method only load the views on views/ folder.

Therefore, your need config first your modules folder in application/config.php file. Place this on the ends of file.

$config['modules_locations'] = array(
    APPPATH . 'modules/' => '../modules/'
);

Next, create your first module with views as sub-folder, and create your view file with .php as extension.

- modules/
--- my_module/
------ views/
--------- my_view.php

Next, in your controller, load the view with the ubication of your module.

$this->load->view('my_module/my_view');

This must run, you can try and read more about the documentation.

Hope this help you!

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top