Prev | Current Page 226 | Next

Emilian Balanescu and Cristian Darie

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

example.com/ */
define('VIRTUAL_LOCATION', '/tshirtshop/');
// Configure product lists display options
define('SHORT_PRODUCT_DESCRIPTION_LENGTH', 150);
define('PRODUCTS_PER_PAGE', 4);
?>
CHAPTER 5 ?–  CREATING THE PRODUCT CATALOG: PART 2 138
Then, modify index.php by adding these lines to it:
// Activate session
session_start();
// Include utility files
require_once 'include/config.php';
require_once BUSINESS_DIR . 'error_handler.php';
// Set the error handler
ErrorHandler::SetHandler();
...
The SHORT_PRODUCT_DESCRIPTION_LENGTH constant specifies how many characters from the
product??™s description should appear when displaying product lists. The complete description
gets displayed in the product??™s details page, which you??™ll implement at the end of this chapter.
PRODUCTS_PER_PAGE specifies the maximum number of products that can be displayed in
any catalog page. If the visitor??™s selection contains more than PRODUCTS_PER_PAGE products, the
list of products is split into subpages, accessible through the navigation controls.
We also enabled the PHP session, which will help us improve performance when navigating
through pages of products.
?– Note Session handling is a great PHP feature that allows you to keep track of variables specific to a certain
visitor accessing the web site. While the visitor browses the catalog, the session variables are persisted
by the web server and associated to a unique visitor identifier (which is stored by default in the visitor??™s
browser as a cookie).


Pages:
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238