English 中文(简体)
codeigniter modular extensions
原标题:

I m trying to implement modular extensions into a codeigniter 2 setup but am having a few problems. I followed the installation instructions on the wiki and everything was working fine. Then I started to play around a bit and try and use it. All I did was create a new module called users with the required folders and added a model class called users_m. I then tried to load this from my welcome module controller. According to the wiki this should be very straightforward. I simply added this line

$this->load->model( users/users_m );

to the constructor of my welcome controller.

Unfortunately at this point I get the white screen of death.

So I tried something else. This time I removed the load model line and added

$this->output->enable_profiler(TRUE);

This time I got the welcome page displayed and I got the profiler, but at the top of the page I got this error:

A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI::$profiler

Filename: MX/Loader.php

Line Number: 145

I don t know if these two tries are related or not, but there s obviously something not right with my setup. Could someone point me in the right direction?

最佳回答

If you accessing the model from the controller in the same module, you can load it using just:

$this->load->model(‘user_m’);

You only have to do $this->load->model(‘module/model_name’); when your cross loading between modules.

Just to make sure, your model is located here right?

application/modules/users/models/users_m.php

As for the profiler error:
1) Have you done installation step 5 and put the Modular Extensions core files into application/core?
2) Do you have the latest version of HMVC? There have been updates to mx/loader.php in the last couple days.

Ps. great tutorial on HMVC: http://net.tutsplus.com/tutorials/php/hvmc-an-introduction-and-application/

问题回答

if you have folder structure like:

application/
           modules/
                  users/
                       models/
                             users_m.php

then use this to call modelsin you controller

$this->load->model( users/users_m ,  ,TRUE);




相关问题
PHP Framework: Ebay Like Site

I am going to be builiding a site like ebay - with all the features of ebay. Please note my payment method is limited to paypal. What would be the best PHP framework to use to build this quickly, ...

What s the proper MVC way to do this....?

Quick question about general MVC design principle in PHP, using CodeIgniter or Kohana (I m actually using Kohana). I m new to MVC and don t want to get this wrong... so I m wondering if i have ...

Check session from a view in CodeIgniter

What is the best way to check session from a view in CodeIgniter, it shows no way in their user guide, otherwise I will have to make two views on everything, which is kinda weird...still a newbie to ...

Using SimplePie with CodeIgniter and XAMPP

I am using CodeIgniter 1.7.2 with XAMPP 1.7.2 on a Windows computer. I am trying to make use of SimplePie. I followed all the instructions I could find: a copy of simplepie.inc is in my applications/...

CodeIgniter adding semicolons

How do I stop CodeIgniter adding semicolons ; to data sent via POST that contains ampersand &? For example it is converting "a=1&b=2&c=3" into "a=1&b;=2&c;=3". From looking on the forums ...

Best way to make Admin pages in CodeIgniter?

I m working on an app in CodeIgniter, and I want to have admin pages for several of the objects in the application, and I m wondering what would be the better way to put these into an MVC structure. ...

CodeIgniter form verification and class

I m using the form validation library and have something like this in the view <p> <label for="NAME">Name <span class="required">*</span></label> <?...

热门标签