JavaScript Editor Ajax software     Free javascripts 



Main Page

// create disallow definition
$url = make_category_product_url($category_name, $category_id,
$product_name, $product_id);
$disallow = str_replace(SITE_DOMAIN, ‘’, $url);
echo “Disallow: “ . $disallow . “\r\n”;
}
?>
Disallow: /cart.php
17.
That’s it! Load
http://seophp.example.com
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
http://
seophp.example.com/robots.txt
yields the results shown in Figure 14-4.
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:
?
brands
— Contains search engine company names.
?
categories
— Contains the categories in which your products are grouped.
?
products
— Contains data about the products in your catalog.
?
product_categories
— 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
products
table, instead of creating the
product_categories
table — just like you’re now
using the
primary_category_id
column in
products
.)
To visualize the relationship between these tables, see the diagram in Figure 14-5.
279
Chapter 14: Case Study: Building an E-Commerce Store
c14.qxd:c14 10:46 279


JavaScript Editor Ajax software     Free javascripts