// create disallow definition
$url = make_category_product_url($category_name, $category_id,
$disallow = str_replace(SITE_DOMAIN, ‘’, $url);
echo “Disallow: “ . $disallow . “\r\n”;
That’s it! Load
and expect to see the page shown in Figure 14-1.
Play around with your site a little bit to ensure it works. Also verify that loading
yields the results shown in Figure 14-4.
Next, analyze how you made this work, and what design decisions you have made to implement the set
of requirements. To understand such an application, even a simple one, you need to start with the data-
base. You need to understand how the database works and how the data is organized.
Your database is comprised of four data tables:
— Contains search engine company names.
— Contains the categories in which your products are grouped.
— Contains data about the products in your catalog.
— Contains associations between products and categories. This table is
required because a category is allowed to contain more products, so that multiple associations
can be created for each product, and for each category. (If each of your products belonged to
a single category, you could have referenced that category through a separate column in the
table, instead of creating the
table — just like you’re now
To visualize the relationship between these tables, see the diagram in Figure 14-5.
Chapter 14: Case Study: Building an E-Commerce Store
c14.qxd:c14 10:46 279