Welcome Guest, Not a member yet? Register   Sign In
Modular Separation - PHP5 (Modules)
#91

[eluser]ralf57[/eluser]
Hi all,
I need to load a view from a different location other than those in module and application folders.
To achieve this I am setting

Code:
$this->CI->load->_ci_view_path = 'my/new/custom/path';

before calling

Code:
$this->CI->load->view($view, $data, TRUE);

in my controller.

The problem is that the method actually called is the one in application/libraries/MY_Loader.php
Is there a way to to call the overridden "view" method (the one defined in system/libraries/Loader.php?
Thanks in advance, ralf
#92

[eluser]dinhtrung[/eluser]
Hi all,
I don't see Modular Separation activate the 'index' method as default for module controllers. Is there any other way to bypass the uri segment 'index', rather than to configure routes?
#93

[eluser]umefarooq[/eluser]
Hi @wiredesignz you library is really good and working fine for me but i have some problem which im facing with modular separation is that is not calling member function of MY_Language and MY_Config of any other library is using. it always checking MX_Language and MX_Config classes in you MY_Loader library. i have check the modular separation with following library

http://maestric.com/doc/php/codeigniter_i18n

How can we solve this problem

EDITED
i have fixed it by extended your MX_Language and MX_Config class with MY_Lanugage and MY_Config file just want to confirm is OK to do so.
#94

[eluser]mooooo[/eluser]
Hi all! First off thanks for this great library!

I have a problem when I try to load a model from a controller.

My folder structure is as follows:

application
- controllers/admin.php
- modules/blog
- controllers/blog.php
- models/blog_model.php
- modules/category
- controllers
- models/category_model.php

From my blog controller I try to following:
Code:
function __construct() {
  parent::Controller();
  $this->load->model('blog_model');
  $this->load->model('category_model');
}

The first model, blog_model, is loaded without any problem but the category_model cannot be found. Am I suppose to add more to the model url to be able to load a different model in my blog controller?

Thanks and regards!

##### EDIT #####

Ahh I'm just crazy today. Noticed that it's as simple as just adding the module name in front of the model name as such:

Code:
$this->load->model('category/category_model');
#95

[eluser]shinokada[/eluser]
Isn't it like this?

Code:
$this->load->module_model('blog','blog_model');

And same for the others?
#96

[eluser]kilishan[/eluser]
First off, love the library. Seems to be MUCH faster than Matchbox. So far I'm thrilled to have made the switch. However, I'm running into a problem trying to load language files.

I have a core_module in 'application/core_modules/pages'. The language file is located in /application/core_modules/pages/language/english/pages_lang.php'.

In my CMS, I'm using the language files to load the names and descriptions of all of the modules so that I can handle enabling/disabling them. Here's the call in my modules model:

Code:
public function get()
    {
        // Get list of directories
        $map = scandir(APPPATH.'modules/');

        // Build our modules list
        $modules = array();
        
        foreach ($map as $key => $file_name)
        {    
            if ($file_name != '.' && $file_name != '..' && is_dir(APPPATH.'modules/'.$file_name))
            {
                $this->load->language($file_name);
            
                $modules[] = $file_name;
            }
        }

        return $modules;
    }

Whenever it runs, it spits out the following error:

Unable to load the requested language file: language/english/welcome_lang.php

Anyone have any ideas what I'm doing wrong, here?

Thanks!
#97

[eluser]wiredesignz[/eluser]
@kilishan, Try including the module name and file name if you need to cross load from another module.
Code:
$file_path = $file_name.'/'.$file_name;
$this->load->language($file_path);
#98

[eluser]kilishan[/eluser]
Well, crap. Thought I had tried that, but just tried again and it worked like a charm. Can't remember for the life of me what I did differently previously, but I guess it really doesn't matter, does it?

Thanks for the assist!
#99

[eluser]theprodigy[/eluser]
just a quick question.

I am able to get my controllers to extend MY_Controller just fine, but I have to use MX_Model in order for them to extend. Why is this? Why will controllers extend the default MY_, but the models need MX_?

When I try to extend MY_Model, it tells me it's not found, but once I change it to MX_Model, it works perfectly.

[eluser]wiredesignz[/eluser]
Modular Separation utilizes spl_autoload(), so your MX_Model parent class will be loaded for you automatically on demand. However it specifically ignores MY_ prefixed parent classes leaving those for CodeIgniter to load.




Theme © iAndrew 2016 - Forum software by © MyBB