Model does not load |
[eluser]boytun[/eluser]
Hello In my application I use the hmvc Strucure to create a widget system. So in my module, and excatly in the controller, I create the frontend (methode edit) and the backend(methode index) of my widget. this is the code of the controller wich located in the module folder(widg_html): Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); the strange problem is, that when I use the edit methode everything (mdl_widg_html also)work fun, but when I want to display the widget in the mvc view(I use index methode wich I load the same model mdl_widg_html) , an error came: Quote:A PHP Error was encountered Please, Help me :/
[eluser]TheFuzzy0ne[/eluser]
I don't understand why you would be getting that error. CodeIgniter should tell you if it was unable to load a model, which it doesn't seem to be. Please could you try to load a non-existent model, to ensure it really will tell you when it fails to load a model? Code: $this->load->model('non_existent_model');
[eluser]boytun[/eluser]
I get this : An Error Was Encountered Unable to locate the model you have specified: non_existent_model
[eluser]boytun[/eluser]
this my model file(mdl_widg_html) Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
[eluser]TheFuzzy0ne[/eluser]
I'm sorry, but I have absolutely no idea what's going on there. I can only assume you might be unsetting it somewhere. Does it make any difference if you autoload the models from ./application/config/autoload.php? I'm not suggesting that as a solution, I'm just curious as to where the problem lies.
[eluser]boytun[/eluser]
when I excute the module directly from the url : localhost/widg_html , it works fun. Very strange.
[eluser]TheFuzzy0ne[/eluser]
Sorry, I think I misunderstood the problem. If http://localhost/widg_html works, what URL are you using when it doesn't work?
[eluser]boytun[/eluser]
I just call the module like this in the mvc view "display.php": <?php echo Modules::run('widg_html') ; ?> so the URL should be localhost
[eluser]TheFuzzy0ne[/eluser]
I'm not familiar with HMVC, although it's something I've been meaning to look into for quite a while now. There may be a simple solution to your problem, but if there is, I don't know what it is. For now, I'd suggest you add the following to your MX_Controller base class: Code: function __get($prop) That might fix your problem. If the requested property can't be found in the current object, the it should pass it back from the CodeIgniter super object if it exists there. If it doesn't, then you'll see an exception. It's up to you whether or not you'd rather use show_error() instead of an exception.
|
Welcome Guest, Not a member yet? Register Sign In |