Ajax software
Free javascripts
↑
Main Page
array($this->_page_number_parameter_index => $next_page))) .
“‘>$this->_next_prompt</a>”;
}
else
{
// no “next >>” link if the visitor is on the last page
$links[] = $this->_next_prompt;
}
// return the pager text
return implode(‘ | ‘, $links);
}
}
?>
13.
It’s time to create
index.php
in your
seophp
folder, with the following code. This file generates
the first page of the catalog, displaying all the existing categories of the catalog:
<?php
// load the catalog library
require_once ‘include/catalog.inc.php’;
// load the URL factory
require_once ‘include/url_factory.inc.php’;
// retrieve the list of categories ordered by name
$categories = Categories::get(0, ‘’, ‘name’);
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html>
<head>
<title>Cookie Ogre’s Warehouse</title>
</head>
<body>
<h1>Cookie Ogre’s Warehouse</h1>
Browse our catalog by choosing a category of products:
<?php
// display each category
echo “<ul>”;
foreach ($categories as $category)
{
$url = make_category_url($category[‘name’], $category[‘id’]);
echo ‘<li>’ .
‘<a href=”‘ . $url . ‘“‘ . ‘>’ . $category[‘name’] . ‘</a>’ .
‘</li>’;
}
echo “</ul>”
?>
</body>
</html>
274
Chapter 14: Case Study: Building an E-Commerce Store
c14.qxd:c14 10:46 274
Ajax software
Free javascripts
→