Use a PHP include to list Products?
Posted: Thu Feb 17, 2011 11:10 pm
I am just wondering, there are many parts of the template where a list of products is used. This includes the home modules, category page, search results, etc. Is there any downside to moving the loop of code that calls and lists the products to its own .php page, and just using an include on any template file that needs a product list?
I'm mostly asking because the same exact loop is used for all of those pages, however if you want to fix the presentation of how the list looks, you would have to edit EVERY one of those pages. Simply editing one page, for example product_list.php, would be a lot easier.
I'm not asking how to do it, as I've already done it to test it out and make sure it works. I'm more so asking if there is any reason not to, and if anyone more skilled in PHP could weigh in with their own opinion.
I'm mostly asking because the same exact loop is used for all of those pages, however if you want to fix the presentation of how the list looks, you would have to edit EVERY one of those pages. Simply editing one page, for example product_list.php, would be a lot easier.
I'm not asking how to do it, as I've already done it to test it out and make sure it works. I'm more so asking if there is any reason not to, and if anyone more skilled in PHP could weigh in with their own opinion.