10-17-2012, 08:37 AM
[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:
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!
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');
The class would include all the vars for the product (title, price, description etc), as well as functions related to individual products.
Cheers!