Home arrow PHP arrow Page 4 - Using PHP to Create Relevant Title Tags in osCommerce Websites

Proper Page Title Naming for the Product Pages - PHP

If you use osCommerce for your site's e-commerce, and you're not happy with the quality or quantity of visitors your site receives, keep reading. Though osCommerce provides some excellent features, its weaknesses could be getting in the way of giving you the number of visitors and conversions you expect. Fortunately, there's a solution, hidden in something as simple as a title tag.

TABLE OF CONTENTS:
  1. Using PHP to Create Relevant Title Tags in osCommerce Websites
  2. osCommerce Web Template Files and Page Title Naming
  3. Proper Page Title Naming for the Home Page and Categories
  4. Proper Page Title Naming for the Product Pages
By: Codex-M
Rating: starstarstarstarstar / 8
May 21, 2009

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

For theProduct_info.php, the following is the recommended script:

<?php

$optimizedurl=$_SERVER["REQUEST_URI"];

$location1=(strpos($optimizedurl,'products_id'));

$start= $location1 + 12;

$productidextracted=substr($optimizedurl,$start,2);

$result = mysql_query("SELECT `products_name` FROM `products_description` WHERE `products_id`='$productidextracted'")

or die(mysql_error());

$row = mysql_fetch_array($result)

or die("Invalid query: " . mysql_error());

echo "<br />";

$titletag = $row['products_name'];

?>

<title><?php echo $titletag; ?></title>

To implement the following recommendations, find this piece of code in the default affected templates:

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

Replace it with the modified PHP script. For theproduct_info.phpthe above lines will now become:

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<?php

$optimizedurl=$_SERVER["REQUEST_URI"];

$location1=(strpos($optimizedurl,'products_id'));

$start= $location1 + 12;

$productidextracted=substr($optimizedurl,$start,2);

$result = mysql_query("SELECT `products_name` FROM `products_description` WHERE `products_id`='$productidextracted'")

or die(mysql_error());

$row = mysql_fetch_array($result)

or die("Invalid query: " . mysql_error());

echo "<br />";

$titletag = $row['products_name'];

?>

<title><?php echo $titletag; ?></title>

To be truly effective, revise the title tag PHP script in all important templates such as index.php, product_info.php, and the main pages in a typical osCommerce website navigation menu.

You can find more osCommerce tips and tricks here:http://www.php-developer.org/



 
 
>>> More PHP Articles          >>> More By Codex-M
 

blog comments powered by Disqus
   

PHP ARTICLES

- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap

Dev Shed Tutorial Topics: