Prev | Current Page 246 | Next

Emilian Balanescu and Cristian Darie

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

Selecting a category displays the category description, as shown in
Figure 5-9.
Figure 5-9. Selecting the Animal category
How It Works: The categories_list Componentized Template
The categories_list componentized template works similarly to the departments_list. The
CategoriesList class (located in the presentation/categories_list.php presentation object file)
has three public members that can be accessed from the template file (categories_list.tpl):
// Public variables for the smarty template
public $mSelectedCategory = 0;
public $mSelectedDepartment = 0;
public $mCategories;
CHAPTER 5 ?–  CREATING THE PRODUCT CATALOG: PART 2 155
$mSelectedCategory retains the category that is selected, which must be displayed with a different style than
the other categories in the list. The same is true with $mSelectedDepartment. $mCategories is the list of
categories you populate the categories list with. This list is obtained with a call to the business tier.
The links in the categories list are created using the Link::ToCategory() method to ensure the consistency of
the links across the site and to ensure they??™re also properly escaped (& is transformed to &, and so on).
Displaying Product Lists
Whether on the main web page or browsing a category, some products should appear instead
of the ???Place list of products here??? text. Here, you create the products_list componentized
template, which is capable of displaying a list containing detailed information about the products.


Pages:
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
Lightning Seeds Marika Morcheeba elf bot skrypty Matisyahu