All that is left to do is use their functionality in the presentation tier. In this final
section, you??™ll create a few Smarty templates and integrate them into the existing project.
Execute the TShirtShop project (or load http://localhost/tshirtshop/ in your favorite
web browser) to see once again what happens when the visitor clicks a department. After the
page loads, click one of the departments. The main page (index.php) is reloaded, but this time
with a query string at the end of the URL:
http://localhost/tshirtshop/index.php?DepartmentId=1
Using this parameter, DepartmentId, you can obtain any information about the selected
department, such as its name, description, list of products, and so on. In the following sections,
you??™ll create the controls that display the list of categories associated with the selected
department and the products for the selected department, category, or main web page.
Displaying Department and Category Details
The componentized template responsible for showing the contents of a particular department
is named department, and you??™ll build it in the exercise that follows. You??™ll first create the componentized
template and then modify the store_front componentized template to load it when
DepartmentId is present in the query string. After this exercise, when clicking a department in
the list, you should see a page like the one in Figure 5-8.
Pages:
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247