April 11, 2012

Codeigniter : Unable to locate the model you have specified

Question by WebNovice

I have upgraded my PHP from version 5.2.9 to 5.3.1 and have encountered the following with my codeigniter application:

Unable to locate the model you have specified: some_model

Codeigniter version 2.1, with HMVC extension
Server: Centos 5

The model names are all in lower case and it is also loaded by calling their lower case letter. Everything used to work before the PHP upgrade.

Answer by Starx

If you are using HMVC, then you have to provide the module name as well.

Like this

$this -> load -> model('module/model_name');
January 23, 2012

Passing arguments to a HMVC Module method using an array

Question by joomlearner

While using the HMVC Component in Codeignitors, we can render a particular actions like this

echo modules::run('site/news/view', 1);

Here the 1 is the parameter send to the view method.

Now I have an array of parameters, which i need to pass to the function

$params = array(1, "latest", "desc"); //suppose this are the parameters I received dynamically some how and dont knows its length

Now, I need to send these parameters seperately as

echo modules::run('site/news/view', 1, "latest", "desc");

Like in other functions call_user_func_array() will not work at this case(I think).

Answer by Starx

Well, its not possible to make an existing function work the way you need (unless modified). You should code, the way THE FUNCTION ALREADY WORKS. If it does not work the way you need, modify the source if allowed, or else write you own version of it, or extend the main class, to fit your needs.

I could answer this question easy, but this time I will want you to do the same. I have answered your question before & just viewed your profile, 6 Questions (1 accepted) 0 answers and on most of the questions no input from your side. You don’t seem to do anything on your own.

You relying on this community to get your job done, which is so unfair. So UNLESS you show me some of your work, I refuse to answer.

...

Please fill the form - I will response as fast as I can!