OSCOMMERCE SUPPORT CALL 702-453-3332

 

Help - Search - Members - Calendar
Full Version: How to change page titles and headings?
osCommerce Community Support Forums > osCommerce Online Merchant v2.x > Tips and Tricks
Jack_mcs
Most new shop masters ask this question and, many times, do it incorrectly. This is meant as a quick quide for how a shops titles and page headings should be handled. The title is the name that appears in the browser. If you look at the title in your browser now, it will show "osCommerce Community Support Forums." The page heading is the text that is displayed on each page of the site. For the home page, it says "What's New Here?"

Changing the title for the site can be done by editing the includes/languages/english.php file. Locate the following line in that file and change it as you like:
CODE
// page title
define('TITLE', 'osCosmmerce');
If you can't find that code, try looking for the following code instead. This is used in the patched versions of oscommerce and allows the shops title to be set in admin->Configuration.
CODE
define('TITLE', STORE_NAME);


Changing the page headings for the home page and the category pages can be done by editing the includes/languages/index.php file. Look for the lines beginning with
CODE
define('HEADING_TITLE',
There will be three such instances.

If you do the above, the title and page heading for your home page will be as you want. But what about your product pages? There is no simple way to change those since the product pages are controlled by one file. The way around this is to install a meta tags contribution. Most, if not all, of them will allow you to control the titles and page headings for the entire site. This is important since the title is the first thing the search engines look at when entering your site. If it is not setup correctly, the chances of doing well in the search engine listings is reduced.

As far as what to change the title of the home page to, don't make the mistake of choosing the site name. The title should be the same as the main keyword you are targeting for that page. A keyword is some word or phase that someone will search for using a seach engine. It is very rare for the name of the shop to be searched for so by using that as the title, you are hurting your chances of being found by such searches.

Jack
bdx
QUOTE (Jack_mcs @ Nov 27 2007, 11:42 AM) *
Most new shop masters ask this question and, many times, do it incorrectly. This is meant as a quick quide for how a shops titles and page headings should be handled. The title is the name that appears in the browser. If you look at the title in your browser now, it will show "osCommerce Community Support Forums." The page heading is the text that is displayed on each page of the site. For the home page, it says "What's New Here?"

Changing the title for the site can be done by editing the includes/languages/english.php file. Locate the following line in that file and change it as you like:
CODE
// page title
define('TITLE', 'osCosmmerce');
If you can't find that code, try looking for the following code instead. This is used in the patched versions of oscommerce and allows the shops title to be set in admin->Configuration.
CODE
define('TITLE', STORE_NAME);


Changing the page headings for the home page and the category pages can be done by editing the includes/languages/index.php file. Look for the lines beginning with
CODE
define('HEADING_TITLE',
There will be three such instances.

If you do the above, the title and page heading for your home page will be as you want. But what about your product pages? There is no simple way to change those since the product pages are controlled by one file. The way around this is to install a meta tags contribution. Most, if not all, of them will allow you to control the titles and page headings for the entire site. This is important since the title is the first thing the search engines look at when entering your site. If it is not setup correctly, the chances of doing well in the search engine listings is reduced.

As far as what to change the title of the home page to, don't make the mistake of choosing the site name. The title should be the same as the main keyword you are targeting for that page. A keyword is some word or phase that someone will search for using a seach engine. It is very rare for the name of the shop to be searched for so by using that as the title, you are hurting your chances of being found by such searches.

Jack



OOPS!

I found the line define ('TITLE', osCommerce'); and I changed the osCommerce to my stores name and I got the follwing error

Parse error: syntax error, unexpected T_STRING in /home/...../public_html/includes/languages/english.php on line 79

I changed it back to osCommerce and I still get the error. What did I do wrong?
satish
You might have placed some special chars or start and end inverted like 'oscommerce' might have been missed.

Satish
bdx
QUOTE (satish @ Jan 4 2008, 02:54 AM) *
You might have placed some special chars or start and end inverted like 'oscommerce' might have been missed.

Satish



Nope I left everything like it was and only changed the osCommerce th emy store name.the ('...'); remains as is. ANy other suggestions
Coopco
QUOTE (bdx @ Jan 4 2008, 07:33 PM) *
OOPS!

I found the line define ('TITLE', osCommerce'); and I changed the osCommerce to my stores name and I got the follwing error

Parse error: syntax error, unexpected T_STRING in /home/...../public_html/includes/languages/english.php on line 79

I changed it back to osCommerce and I still get the error. What did I do wrong?

Can you post the offending line?
satish
do paste your defines.

Its for sure that there is some ' in the text.

Satish
nitehawk
I just did the same thing , changed the texted only and now I as well get the same error. tried to change it back... same error. retyped the line... same thing.. any suggestions as it crashed the site and i would like to get it back.

// charset for web pages and emails
define('CHARSET', 'iso-8859-1');

// page title
define('TITLE', 'osCommerce');

// header text in includes/header.php

this is the line I want to change.. and then changed it back to 'osCommerce'
Jack_mcs
QUOTE (nitehawk @ Jan 24 2008, 10:48 AM) *
I just did the same thing , changed the texted only and now I as well get the same error. tried to change it back... same error. retyped the line... same thing.. any suggestions as it crashed the site and i would like to get it back.
What error are you seeing?

Jack
nitehawk
QUOTE (Jack_mcs @ Jan 24 2008, 01:52 PM) *
What error are you seeing?

Jack

Thank-you for looking at my Problem Jack
this is the error that shows when I make the change

Parse error: parse error, unexpected T_STRING in /var/www/vhosts/pegasusproducts.ca/httpdocs/includes/languages/english.php on line 79

When I remove the line completley I error Message moves up one line (78)

This has happened before when I have made changes and I have been able to fix the problem by retypeing the while php file but this one is way to big to retype

thanks for looking
John
nitehawk
QUOTE (nitehawk @ Jan 24 2008, 04:52 PM) *
Thank-you for looking at my Problem Jack
this is the error that shows when I make the change

Parse error: parse error, unexpected T_STRING in /var/www/vhosts/pegasusproducts.ca/httpdocs/includes/languages/english.php on line 79

When I remove the line completley I error Message moves up one line (78)

This has happened before when I have made changes and I have been able to fix the problem by retypeing the while php file but this one is way to big to retype

thanks for looking
John


Well seems I fixed my problem. The error was not on the line where i made the change it was actually further down. it seems the for some reason when i made the change i wanted the apostophies (') are not recognized as such. i had to remove the (') in the "what's new" so it now reads "whats new" . does anyone know why and how I can put it back??
Glcustoms
QUOTE (nitehawk @ Jan 24 2008, 05:33 PM) *
Well seems I fixed my problem. The error was not on the line where i made the change it was actually further down. it seems the for some reason when i made the change i wanted the apostophies (') are not recognized as such. i had to remove the (') in the "what's new" so it now reads "whats new" . does anyone know why and how I can put it back??

you need to put a slash in front of the apostrophie so it should look like this: what\'s new
nitehawk
QUOTE (Glcustoms @ Jan 24 2008, 06:50 PM) *
you need to put a slash in front of the apostrophie so it should look like this: what\'s new

Thank you ..... it works now ..

I still do not understand why I had the original problem on a line that was half way down the script when all I did was Title change
But it is starting to look good now.

Thanks for the help /i am going to need more as I develop this site nice to know it is here
diy
I used infromation from oscommercehowto.com which is now down and I managed to change the heading title not only to display the stor name but also the name of the category. But I dont remember how I didi it. Now I checked my index php and i found

on line 68
CODE
<td class="pageHeading"><?php echo $myCategory['categories_name']; ?></td>


on line 234
CODE
<td class="pageHeading"><?php echo $myCategory['categories_name']; ?></td>


and on line 292

CODE
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>


is this what I did to display category name on the title header of the browser????

ps on the original index.php

lines 66-232 and 290 look like

CODE
td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.