JavaScript Editor Ajax software     Free javascripts 



Main Page

// builds a link that contains a category and a product
function make_category_product_url($category_name, $category_id,
$product_name, $product_id)
{
// prepare the product name and category name for inclusion in URL
$clean_category_name = _prepare_url_text($category_name);
$clean_product_name = _prepare_url_text($product_name);
// build the keyword-rich URL
$url = SITE_DOMAIN . ‘/Products/‘ .
$clean_category_name . ‘-C’ . $category_id . ‘/‘ .
$clean_product_name . ‘-P’ . $product_id . ‘.html’;
// return the URL
return $url;
}
?>
4.
In your
seophp
folder, create a file named
catalog.php
with these contents:
<?php
// load the URL factory library
require_once ‘include/url_factory.inc.php’;
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN”
“http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
<html>
<head>
<title>The SEO Egghead Shop</title>
</head>
<body>
<h1>Products on Promotion at SEO Egghead Shop</h1>
<ul>
<li>
<a href=”<?php echo make_category_product_url(“Carpenter’s Tools”, 12,
i
“Belt Sander”, 45); ?>”>
Carpenter’s Tools: Belt Sander
</a>
</li>
<li>
<a href=”<?php echo make_category_product_url(“SEO Toolbox”, 6, “Link
i
Juice”, 31); ?>”>
SEO Toolbox: Link Juice
</a>
</li>
<li>
<a href=”<?php echo make_category_product_url(“Friends’ Shed”, 2, “AJAX
i
PHP Book”, 42); ?>”>
Friends’ Shed: AJAX PHP Book
</a>
68
Chapter 3: Provocative SE-Friendly URLs
c03.qxd:c03 10:39 68


JavaScript Editor Ajax software     Free javascripts