So, you have "products" and you have them in categories. Is the "category list" typically its own class method, or does each "product" object know how to display itself in a category list?
Approach the 1st:
class Category {
public blah, blah...
function display() {
//select from the DB
//write or return formatted HTML
}
And the other way:
class Category {
public blah, blah...
function display() {
foreach ($this->category_list as $product_code) {
$item = new Product($product_code);
$item->display();
}
}
The second seems like it'd be "cleaner", easier-to-read and such, but I'm balking at the idea of creating $n-hundred objects for every page load.
Thoughts? I suppose there might even be more ways to skin this cat? Thanks in advance!