Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Page Title


geoff.atkins@inchcruin.com

Recommended Posts

I know it's possible but cannot find anywhere to create a page title to display in the browser title bar. The answer must be simple but I cannot find any reference to it in the documentation (probably because it's too simple to bother with documentation!) or by searching the php files. Please could someone point me in the right direction.

 

Many thanks

Link to comment
Share on other sites

I know it's possible but cannot find anywhere to create a page title to display in the browser title bar. The answer must be simple but I cannot find any reference to it in the documentation (probably because it's too simple to bother with documentation!) or by searching the php files. Please could someone point me in the right direction.

 

Many thanks

I think its in catalog/includes/languges/english.php

( WARNING )

I think I know what Im talking about.

BACK UP BACK UP BACK UP BACK UP

Link to comment
Share on other sites

  • 2 years later...

Thanks for this.... here's my little modification...

 

<title><?php echo TITLE; ?> <?php echo substr(strip_tags($breadcrumb->trail(' » ')),20); ?></title>

 

Adds the site name in front of the breadcrumbs and trims off the first 20 characters of the crumbs which is " Top » Catalog "

 

CB

Link to comment
Share on other sites

  • 2 months later...
Also try this:

 

<title><?php echo strip_tags($breadcrumb->trail(' » ')); ?></title>

 

You can customise it in many diferent ways. :thumbsup:

 

Hey guys, where do you put this line? In english.php or header.php, or you have to change all the files that are containing <title> tag?

Link to comment
Share on other sites

  • 3 weeks later...
Hey guys, where do you put this line? In english.php or header.php, or you have to change all the files that are containing <title> tag?

 

Hello Folks,

 

Im using the STS System, and therefore in my includes/modules/sts_inc/general.php

 

I Replaced:

$sts->template['headertags']= "<title>" . TITLE ."</title>";

 

With:

$sts->template['headertags'] = "<title>". TITLE .": ".substr(strip_tags($breadcrumb->trail(' » ')),7)."</title>";

 

Note that my trim is only "7" since my breadcrumbs are modified and I added a ": "

Link to comment
Share on other sites

  • 2 weeks later...
Hello Folks,

 

Im using the STS System, and therefore in my includes/modules/sts_inc/general.php

 

I Replaced:

$sts->template['headertags']= "<title>" . TITLE ."</title>";

 

With:

$sts->template['headertags'] = "<title>". TITLE .": ".substr(strip_tags($breadcrumb->trail(' » ')),7)."</title>";

 

Note that my trim is only "7" since my breadcrumbs are modified and I added a ": "

 

 

This is important stuff for search engine optimization. Thanks for posting that elegant fix.

 

I wasn't happy with the way breadcrumbs worked out in my particular store because I have a lot of custom pages without breadcrumbs, and I'm only using one language, so I went back to the mySQL functions and wrote it this way:

 

In:

includes/modules/sts_inc/general.php

At around line 68, comment out the same line mentioned in the posts above:

//$sts->template['headertags']= "<title>" . TITLE ."</title>";

 

Then add this:

//<<<<<<<<<<<<<<<<<<<<<<<<<<<<SEOTITLE>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

$generalStoreFocus = "";//Place a word about your general store focus here if you like

 

if($_GET['cPath']){

$n = $_GET['cPath'];

$sql = 'SELECT `categories_name` FROM `categories_description` WHERE language_id = 1 AND categories_id = '.$n;

$query = tep_db_query($sql);

$qArray = tep_db_fetch_array($query);

$titleCat = $qArray['categories_name'];

$titleProd = "";

if($_GET['products_id']){

$n = $_GET['products_id'];

$sql = 'SELECT `products_name` FROM `products_description` WHERE products_id = '.$n;

$query = tep_db_query($sql);

$qArray = tep_db_fetch_array($query);

$titleProd = ": ".$qArray['products_name'];

}

if($generalStoreFocus != ""){

$generalStoreFocus .= " ";

}

$SEOTitle= $generalStoreFocus.$titleCat.$titleProd." from ".STORE_NAME;

 

}else{

$SEOTitle=TITLE;

}

$sts->template['headertags']= "<title>" . $SEOTitle ."</title>";

//<<<<<<<<<<<<<<<<<<<<<<<<<<END SEOTITLE>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Link to comment
Share on other sites

  • 5 weeks later...
I think its in catalog/includes/languges/english.php

 

For those of us just using osCommerce with no template system, yes it's in catalog/includes/languges/english.php, and it's on or near line #48 in that file. You'll probably need to change it for each language. e.g. english.php, german.php, etc. Change the following line:

define('TITLE', 'osCommerce');

 

Change 'osCommerce' to the name of your store or whatever you want. Be sure to keep the single quotes:

define('TITLE', 'New Name of My Store');

Link to comment
Share on other sites

For those of us just using osCommerce with no template system, yes it's in catalog/includes/languges/english.php, and it's on or near line #48 in that file. You'll probably need to change it for each language. e.g. english.php, german.php, etc. Change the following line:

define('TITLE', 'osCommerce');

 

Change 'osCommerce' to the name of your store or whatever you want. Be sure to keep the single quotes:

define('TITLE', 'New Name of My Store');

 

The same applies to the admin area at catalog/admin/includes/languages/english.php on line #43. This changes the <TITLE> of the admin area.

Link to comment
Share on other sites

  • 1 month later...
This is important stuff for search engine optimization. Thanks for posting that elegant fix.

 

I wasn't happy with the way breadcrumbs worked out in my particular store because I have a lot of custom pages without breadcrumbs, and I'm only using one language, so I went back to the mySQL functions and wrote it this way:

 

In:

includes/modules/sts_inc/general.php

At around line 68, comment out the same line mentioned in the posts above:

//$sts->template['headertags']= "<title>" . TITLE ."</title>";

 

Then add this:

//<<<<<<<<<<<<<<<<<<<<<<<<<<<<SEOTITLE>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

$generalStoreFocus = "";//Place a word about your general store focus here if you like

 

if($_GET['cPath']){

$n = $_GET['cPath'];

$sql = 'SELECT `categories_name` FROM `categories_description` WHERE language_id = 1 AND categories_id = '.$n;

$query = tep_db_query($sql);

$qArray = tep_db_fetch_array($query);

$titleCat = $qArray['categories_name'];

$titleProd = "";

if($_GET['products_id']){

$n = $_GET['products_id'];

$sql = 'SELECT `products_name` FROM `products_description` WHERE products_id = '.$n;

$query = tep_db_query($sql);

$qArray = tep_db_fetch_array($query);

$titleProd = ": ".$qArray['products_name'];

}

if($generalStoreFocus != ""){

$generalStoreFocus .= " ";

}

$SEOTitle= $generalStoreFocus.$titleCat.$titleProd." from ".STORE_NAME;

 

}else{

$SEOTitle=TITLE;

}

$sts->template['headertags']= "<title>" . $SEOTitle ."</title>";

//<<<<<<<<<<<<<<<<<<<<<<<<<<END SEOTITLE>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

 

Is there anything like this for those not using STS as having problems with custom meta tags and everything helps

Complete Newbie On The Learn - Not A Programmer

But Learning As I Go

Link to comment
Share on other sites

Thanks for this.... here's my little modification...

 

<title><?php echo TITLE; ?> <?php echo substr(strip_tags($breadcrumb->trail(' » ')),20); ?></title>

 

Adds the site name in front of the breadcrumbs and trims off the first 20 characters of the crumbs which is " Top » Catalog "

 

CB

Hi

 

Use this code. Works for me. Used in all main pages. I had to change the 20 to 4. Just play around with this number until it looks right. See it in action at www.icr-records.co.uk

 

Cheers

 

Ian

Link to comment
Share on other sites

  • 4 months later...

ok got a strange problem tried all the suggestions above and they work fine in firefox but the title doesnt change at all in IE7 it just says E-commerce which is what it said from when the site was installed

 

any idea's guys?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...