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

[eluser]ronan13[/eluser]
... sorry, ignore this post

[eluser]daparky[/eluser]
I'm running into a slight problem....

CI Version: Latest branch as of 05/12/2010
ME version: Latest branch as 05/12/2010

Basically i'm doing some testings with ME before i move ahead and use it for my CI app. I have a module called welcome with controller, models, libraries and views folders. I have a controller called admin.php, model called test_mode.php, library called Test_library.php and view called welcome_message.php which is in an admin folder within views.

My admin.php controller:

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Admin extends CI_Controller {

    function __construct()
    {
        parent::__construct();
    }

    function index()
    {
        $this->load->library('welcome/test_library');
        $this->load->view('admin/welcome_message');
    }
}

My test_mode.php model:

Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Test_mode extends CI_Model
{

}

My Test_library.php library:

Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Test_library
{
    public function __construct()
    {
        $this->ci =& get_instance();
        $this->ci->load->model('welcome/test_mode');

    }

}

So if i go to the url welcome/admin it should show the admin view file but instead i get this error message:

Code:
Fatal error: Call to undefined method Test_mode::_assign_libraries() in path_to_app\application\third_party\MX\Loader.php on line 227

If i remove the model call out of the Test_library, my page shows. Why can't i call a model from the library? I get the same error whether i extend CI_Controller or MX_Controller.

I tried naming the model the same as libray and got:

Code:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 261900 bytes) in path_to_app\application\third_party\MX\Modules.php on line 160

Please help.

[eluser]wiredesignz[/eluser]
The line numbers shown in your errors are very strange and don't look related. Could you post those lines of code and the version number for Modular Extensions HMVC?

[eluser]daparky[/eluser]
[quote author="wiredesignz" date="1291651045"]The line numbers shown in your errors are very strange and don't look related. Could you post those lines of code and the version number for Modular Extensions HMVC?[/quote]

Something extremely strange is going on... i just downloaded the repo again and the line numbers are indeed different but i'm absolutely sure i downloaded the same repo last night. I will test again now and report back.

UPDATE

I've re-downloaded MX and it's now working, so what has changed in the last 24 hours? Something weird must of been going on. Thanks anyway.

[eluser]shanemesser[/eluser]
[post deleted]

[eluser]Evollution[/eluser]
PLS HELP me a litle

so for example i wanna create module blog ...

i create a map blog in modules folder .. and after that how sould i include this module and where ?!

[eluser]Shaleny[/eluser]
Hi all, HMVC is a fantastic solution for Codeigniter, it makes development on CI more comfortable.
I have a little problem with config files. I need to access module config files from other modules, but, if files have the same name, only first file is loaded and become global for all modules. For example, i have config/config.php file in each module folder and config item like $config['cacheable_methods'] = array('method1','method2'); in it. How I can access this item?

[eluser]Shaleny[/eluser]
Ok, i found a solution that works for me
//Add to application/third_party/MX/Controller.php method:
Code:
public function get_config($item = null){
    $module = strtolower(get_class($this));
    $this->config->load($module,true,true);
    if(!$item)return $this->config->item($module);
    else return $this->config->item($item , $module);
}
A single parameter is a key, which value we want to take, otherwise full config file will be returned.
But now config file name must be the same as Controller class name.
With this method we can use the same config keys in different modules.
Code:
$this->load->module(module_name);
$module_config = $this->module_name->get_config();

[eluser]costicanu[/eluser]
It's working fine with Codeigniter 2, Great! Thank you!

[eluser]Keat Liang[/eluser]
hi wiredesignz, i been using HMVC for a while. and i discover some minor glitch.

i'm using CI 2.0.1 Reactor, with latest HMVC Code.

when the directory structure like this the load view does not work, said not found

Code:
/application/modules/sample
/application/modules/sample/controllers/sample.php
/application/modules/sample/views/sample/sample_view.php

in controller
Code:
class Sample_Controller extends MX_Controller{
     function __construct(){parent::__construct();}
     function index()
     {
         $this->load->view('sample/sample_view'); // this will not work
     }
}

i found out when module folder name
Code:
/application/modules/sample

is as same as inside view folder
Code:
/application/modules/sample/views/sample/

when you try to load something from that folder
Code:
$this->load->view('sample/some_view');

it will not work.

sorry for my bad english, i'm trying explain the best i could.

workaround is, just change the folder name inside the view folder (ugly fix)
from this
Code:
/application/modules/sample/views/sample/

to this
Code:
/application/modules/sample/views/sample_/

hope this will same some trouble, if someone encounter this problem too Wink




Theme © iAndrew 2016 - Forum software by © MyBB