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

[eluser]Lpeek[/eluser]
Hi all! I'm just trying to figure out where things should be going in my file structure.

I have a controller which, for example, would be 'category' which will show a set of products in a category. But what would I do to create the products? Before CI, I would have created a product.php class and put it simply in a classes folder. I would then loop through my products and create a new instance of the product class for each and do whatever I need with it with $product->title etc.

I'm wondering whether in CI would I use a model, a helper, or would I create a product.php in libraries? And when I load, would I simply call:
Code:
$this->load->library('product');
which would replace $this->product each time I load it?

The class would include all the vars for the product (title, price, description etc), as well as functions related to individual products.

Cheers!


Messages In This Thread
Do I use a model, library or helper? - by El Forum - 10-17-2012, 08:37 AM
Do I use a model, library or helper? - by El Forum - 10-17-2012, 02:23 PM
Do I use a model, library or helper? - by El Forum - 10-18-2012, 01:22 AM
Do I use a model, library or helper? - by El Forum - 10-18-2012, 01:34 AM
Do I use a model, library or helper? - by El Forum - 10-18-2012, 01:41 AM
Do I use a model, library or helper? - by El Forum - 10-18-2012, 02:05 AM
Do I use a model, library or helper? - by El Forum - 10-18-2012, 02:11 AM
Do I use a model, library or helper? - by El Forum - 10-18-2012, 02:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB