Prev | Current Page 308 | Next

Emilian Balanescu and Cristian Darie

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


Catalog::GetDepartmentName($_GET['DepartmentId']);
if (isset ($_GET['Page']) && ((int)$_GET['Page']) > 1)
$page_title .= ' - Page ' . ((int)$_GET['Page']);
}
CHAPTER 7 ?–  SEARCH ENGINE OPTIMIZATION 208
elseif (isset ($_GET['ProductId']))
{
$page_title = 'TShirtShop: ' .
Catalog::GetProductName($_GET['ProductId']);
}
else
{
if (isset ($_GET['Page']) && ((int)$_GET['Page']) > 1)
$page_title .= ' - Page ' . ((int)$_GET['Page']);
}
return $page_title;
}
4. Update presentation/templates/store_front.tpl like this:


{$obj->mPageTitle}

rel="stylesheet" />

5. Load a page other than the front page in TShirtShop and notice its new, customized page title, which is
highlighted in Figure 7-5 (the title of the front page remains the same).
Figure 7-5. Creating customized product titles
CHAPTER 7 ?–  SEARCH ENGINE OPTIMIZATION 209
How It Works: Creating Page Titles
In this exercise, we updated the StoreFront class to use data gathered using the GetDepartmentName(),
GetCategoryName(), and GetProductName() of the Catalog class to build the wanted titles for the department,
category, and product pages. The Smarty template was also updated to display the newly built title instead
of the default one.


Pages:
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320