Prev | Current Page 243 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"


For this, you??™ll implement a new Smarty template named categories_list. categories_list is
very similar to the department_list componentized template. It consists of a template section
used for looping over the array of categories data (category name and category ID). This template
section will contain links to index.php, but this time, their query string will also contain a
CategoryId showing that a category has been clicked, like this:
http://localhost/tshirtshop/index.php?DepartmentId=1&CategoryId=2
The steps in the following exercise are very much like the ones for the departments_list
componentized template (created at the end of Chapter 4), so we??™ll move a bit more quickly
this time.
CHAPTER 5 ?–  CREATING THE PRODUCT CATALOG: PART 2 152
Exercise: Creating the categories_list Componentized Template
1. Create the Smarty template for the categories_list componentized template. Write the following lines in
presentation/templates/categories_list.tpl:
{* categories_list.tpl *}
{load_presentation_object filename="categories_list" assign="obj"}
{* Start categories list *}

Choose a Category