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

[eluser]wiredesignz[/eluser]
[quote author="Adods" date="1246475825"]
Code:
$this->load->view('module/view');
will this work too??[/quote]

Yes, it should.

[eluser]Adods[/eluser]
i have directory structure like this in modules folder:
Code:
another/
    views/
welcome/
    controllers/
         welcome.php
    views/
         another/
             welcome_message.php

when i try to load view using:
Code:
$this->load->view('another/welcome_message');

i got 'Unable to locate the file' error.

how i can fix this?

[eluser]Adods[/eluser]
I make a few modifications in Modules.php
from:
Code:
if (is_dir(MODBASE.$subpath.$base)) {
    $modules[] = MODBASE.$subpath;
} else {
    $path .= $subpath;
}

to:
Code:
if ($module && is_dir(MODBASE.$module.'/'.$base.$subpath)) {
    $path = str_replace(APPPATH, '', MODBASE).$module.'/'.$base.$subpath;
} else if (is_dir(MODBASE.$subpath.$base)) {
    $modules[] = MODBASE.$subpath;
} else {
    $path .= $subpath;
}

and it works
i hope you can make it better than this

[eluser]wiredesignz[/eluser]
Is there a reason to have a module and sub-directory in a different module with the same name? Although I can see how using 3rd party modules may cause this type of issue. Let me review the modules::find code in any case. Thanks.

[eluser]Adods[/eluser]
yes, maybe the real structure look like this:
Code:
gallery/
    controllers/
        gallery.php
    models/
        gallery_model.php
    views/
        gallery_cat.php
        gallery_list.php
        gallery_detail.php
admin/
    controllers/
        admin.php
        .....
        gallery_admin.php
        .....
    views/
        .....
        gallery/
            manage.php
            form.php
        .....
        module_list.php

which i call the view from gallery_admin.php

[eluser]wiredesignz[/eluser]
It might be easier if you locate the gallery admin sub-directories inside the gallery module.
Code:
gallery/
    controllers/
        gallery.php
        admin/
            gallery_admin.php
    models/
        gallery_model.php
    views/
        gallery_cat.php
        gallery_list.php
        gallery_detail.php
        admin/
            manage.php
            form.php
        ...

[eluser]Adods[/eluser]
I don't know, but I think put backend files in separated from frontend files will be easier to manage

[eluser]Enshteyn[/eluser]
Hello!

I have a file MX_Controller with three classes.

Base -> parent::Controller()
Frontend -> parent::Base()
Backend -> parent::Base()

There is a module "auth" with library "Auth_lib". I need to load the library "Auth_lib" in the constructor of class "Base"

I did so:
Code:
public function Base() {
        
        parent::Controller();
        
        $this->_autoload_mods();
    }
    
    // --------------------------------------------------------------------
    
    /**
     * Автозагрузка библиотек модулей
     *
     * @access    private
     * @return    void
     **/
    
    private function _autoload_mods() {
        
        $list = array(
            'auth' => 'Auth_lib'
        );

        foreach ($list as $key => $value) {
            $this->load->library($key . '/' . $value);
        }
    }

But with this method of classes "Frontend" and "Backend" mix, but this should not be.
How you can implement a global autoload library module?

[eluser]wiredesignz[/eluser]
You can use an $autoload array in any module controller, using the same array spec as you have in config/autoload.php
Code:
class Base_Controller extends Controller
{
    public $autoload = array(
        'language'    => array('base'),
        'config'      => array('validation'),
        'libraries'   => array('auth/auth_lib', 'form_validation'),
        );

You can also specify which module you wish to cross load a resource from as "module/filename"
Code:
$this->load->library('auth/auth_lib');

[eluser]Enshteyn[/eluser]
thank you!




Theme © iAndrew 2016 - Forum software by © MyBB