CodeIgniter Forums
I have a problem with new module - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forum-22.html)
+--- Thread: I have a problem with new module (/thread-26275.html)



I have a problem with new module - El Forum - 01-10-2010

[eluser]huutri[/eluser]
I cannot use $this->load->module_model in view in new my module. Please help me


I have a problem with new module - El Forum - 01-10-2010

[eluser]JHackamack[/eluser]
Load the model in the controller and call it in the view.

Controller:
$this->load->model('model_name');


View:
$this->model_name->function($params);


I have a problem with new module - El Forum - 01-10-2010

[eluser]huutri[/eluser]
I have problem in load model with PyroCMS. I use $this->load->module_model in view in new my module but it can not work. Can you help me


I have a problem with new module - El Forum - 01-10-2010

[eluser]Phil Sturgeon[/eluser]
Could you give more detail on what is "not working"? Is it white screen, error message or did your monitor explode?


I have a problem with new module - El Forum - 01-10-2010

[eluser]huutri[/eluser]
This is code in view layer in new my module:
$this->load->module_model('productcategories','mproductcategories');
$listcate = $this->mproductcategories->GetAllCategories('vn');

I get a error: "A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Loader::$mproductcategories
Filename: views/index.php"

"Fatal error: Call to a member function GetAllCategories() on a non-object"

Can you explain to me how to call a function in model from view layer in a module. Thanks you very much


I have a problem with new module - El Forum - 01-10-2010

[eluser]huutri[/eluser]
I also another problem: I can not call a function in model to view in sam module with PyroCMS. Can you help me??