Welcome Guest, Not a member yet? Register   Sign In
Modular Extensions - HMVC version 5.2

[eluser]Sam Dark[/eluser]
Got a report from Russian community member:

ME — 5.2.0.9
CI — 1.7.1

In the main application I use my own library for templates output.

application/libraries/Viewlib.php
Code:
class Viewlib
{
    public $CI;

    public function __construct($params = array())
    {
        $this->CI = &get;_instance();
    }

    public function show($template, $data = null, $return = false)
    {
        return $this->CI->load->view($template, $data, $return);
    }

}

In the master template I'm calling several modules and templates.
— master template (app views folder) calling module (module uses it's own views folder)
— master template (app views folder) calling another template ("footer" from main app views folder)
— getting an error "File not found".

Doing a bit of debugging showed that template path points to last used module views folder.

application/controllers/welcome.php
Code:
class Welcome extends Controller
{
    public function __construct()
    {
        parent::Controller();
        $this->load->library('viewlib');
    }

    public function index()
    {
        $this->viewlib->show('main_app_template');
    }
}

modules/module/controllers/module.php
Code:
class Module extends Controller
{
    public function __construct()
    {
        parent::Controller();
    }

    public function index()
    {
        $this->load->view('module_template');//use CI Output.
    }
}

application/views/main_app_template.php
Code:
<div> &lt;?php Modules::run('module'); ?&gt; </div>
&lt;?php

echo $this->viewlib->show('main_app_template_footer'); // here I've got "file not found"
?&gt;

[eluser]wiredesignz[/eluser]
@Sam, Try removing (commenting out) the loader reference to _ci_view_path in Controller.php line 89

[eluser]Sam Dark[/eluser]
@wiredesignz, thanks. It works.

[eluser]BDT[/eluser]
I have a class (name tpl) where i have the addmodulecss function. This function add dynamic css location to the tpl class modulcssfiles variable.

If i load module, and the module load his own view, and the view add dynamic css file to the tpl class, the "master" tpl class not receive this new css files and in the final rendering this css files not added to the html output.

How can i solve this? Define global variable and add the css files to this global css array?
(The tpl class extends smarty class. With HMVC 5.1.40 this is work for me... )

[eluser]Johan André[/eluser]
Hey!

I know this has been discussed somewhere before.
I need to load models across modules. I've solved it by adding functionality to the ME loader, a function named module_model($modelname, $module).

Why is'nt this functionality in ME to begin with? Please remind me! Smile
Maybe it's just me using this kindof structure?

I know I read somewhere that models used by multiple modules should be treated as shared models and placed in the models-dir.

My opinon (without thinking of it too much) is that they belong in a module.
In my apps I tend to end up with small modules like:

* Cities (adds / edit / delete)
* Categories (adds / edit / delete)

Often the models of these modules must be used in other modules, like:

* Places (needs dropdown with all cities and dropdown with all categories when adding or updating.)

Am I overthinking it? Smile

[eluser]BDT[/eluser]
Hey! Smile

I don't know this has been discussed somewhere before Smile

I use this solution to generate template box from module (example: login box, or available languages box with select links)
If the box need additional css what is used only for the box i call $this->tpl->addModuleCss($ModuleName,'BoxCss.css'); and my template generator system (based in smarty) insert the header tags when i call (from the actual controller function) $this->DisplayLayout();

I have a helper in the module helpers directory.
From another controller i call $this->bdtbase->loadModuleHelper($Module,$HelperName);
In helper i use this:
$Module = 'users';
$ModulAssigns['Module'] = $Module;
$Modul = Modules::load($Module);
$SideUserBox = $Modul->load->view('OldalSavUserBox',$ModulAssigns,true);
return $OldalSavUserBox;
In the OldalSavUserBox view: $this->tpl->addModuleCss($Module,'BoxCss.css'); but the "master" tpl class not know this module css Sad

Currently i reading php.net... and if i found solution, i will share.
Sorry my bad english Smile

[eluser]BDT[/eluser]
Hmm, the "box generator functions" is executes after the controller function.
i create debug messages, this is the output:

DEBUG - 2009-05-28 23:47:26 --&gt; BDTDEBUG: active module controller calling displaylayout
DEBUG - 2009-05-28 23:47:26 --&gt; BDTDEBUG: GenerateOldalSavUserBox helper function is running
DEBUG - 2009-05-28 23:47:26 --&gt; BDTDEBUG: oldalsavuserbox view is running

I need the "active module controller calling displaylayout" line is the last in the debug log.

[eluser]BDT[/eluser]
I am sorry for the questions. My attention avoided it:
I only need to put the generating function callings into controller constructor.

Sorry, i am very tired...

[eluser]wiredesignz[/eluser]
Modular Extensions version 5.2.10 is available on the wiki.

Controllers may now be loaded from module controllers sub-directories.
Resources may now be cross loaded from other modules.
Code:
$this->load->model('module/model');

[eluser]Adods[/eluser]
Code:
$this->load->view('module/view');
will this work too??




Theme © iAndrew 2016 - Forum software by © MyBB