CHAPTER 5 ?– CREATING THE PRODUCT CATALOG: PART 2 146
Figure 5-8. Selecting the Regional department
Exercise: Displaying Department Details
1. Add the following two styles to the tshirtshop.css file from the styles folder. You??™ll need them for
displaying the department??™s title and description:
.title {
border-left: 15px solid #0590C7;
padding-left: 10px;
}
.description {
font-style: italic;
}
2. Create a new template file named blank.tpl in the presentation/templates folder with the following
contents:
{* Smarty blank page *}
Yes, this is a blank Smarty template file, which contains just a comment. You??™ll use it a bit later. Make sure
you add that comment to the file; if you leave it empty, you??™ll get an error when trying to use the template??”
and that??™s never fun.
3. Create a new template file named department.tpl in the presentation/templates folder, and add
the following code to it:
{* department.tpl *}
{load_presentation_object filename="department" assign="obj"}
{$obj->mName}
{$obj->mDescription}
Place list of products here
CHAPTER 5 ?– CREATING THE PRODUCT CATALOG: PART 2 147
The two presentation object members, $obj->mName and $obj->mDescription, contain the name and
description of the selected department. The Department presentation object is created by the presentation/
smarty_plugins/function.
Pages:
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248