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
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- 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...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: