model or library - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: model or library (/showthread.php?tid=14299) |
model or library - El Forum - 12-27-2008 [eluser]umefarooq[/eluser] hi i have created a model for one controller which will be the same for rest of the models of other controllers in my application. i want to ask is it better repeat the code again and again for every model or its better to create the library for my models. ill edit only a single file will effect my whole application. model or library - El Forum - 12-27-2008 [eluser]Senthilguru[/eluser] Hi dude, I hope u r trying to use a model function in another model.... you can use a model function in to another model or in a controller.. do it like this //Load this model in your controller or in another model Code: $this->load->model('sampleModel'); //Call the function of sample model ...in controller or in a model Code: $this->sampleModel->calulate(); I hope this is thing u r expecting.... Have a nice day... Cheers, senthilguru.e cogzideltemplates.com model or library - El Forum - 12-27-2008 [eluser]bitist[/eluser] [quote author="umefarooq" date="1230409957"]hi its better to create the library for my models. ill edit only a single file will effect my whole application.[/quote] Yes this is the better way. In this case you can develop a single file, which is usable in all your models/controllers. model or library - El Forum - 12-28-2008 [eluser]umefarooq[/eluser] thanks for reply any other expert want to give the answer for the question |