using model and database on libraries |
[eluser]adwin[/eluser]
Hi, I would like to know how to call a model inside a library and how to access database inside the library ? can the method/function inside controller (let' say it PageOneController.foo() ) called by another Controller (AnotherPageController.bar() ) ? how to do that thank you
[eluser]ciGR[/eluser]
You must use the Code: $CI =& get_instance(); for example Code: $CI->load->model('modelname');
[eluser]adwin[/eluser]
I tried your example inside the library constructor: $CI =& get_instance(); $CI->load->library("database"); this produce error .... Unable to load the requested class: database any idea why it produce error ?
[eluser]pistolPete[/eluser]
The database class is loaded using: http://ellislab.com/codeigniter/user-gui...cting.html Code: $CI->load->database(); |
Welcome Guest, Not a member yet? Register Sign In |