Welcome Guest, Not a member yet? Register   Sign In
model or library
#1

[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.
#2

[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
#3

[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.
#4

[eluser]umefarooq[/eluser]
thanks for reply any other expert want to give the answer for the question




Theme © iAndrew 2016 - Forum software by © MyBB