Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Titles on index category pages.


72 replies to this topic

#1 dburchm1

  • Community Member
  • 123 posts
  • Real Name:Dan Burch
  • Location:Gresham, Oregon, USA

Posted 12 March 2004, 23:59

Hi, found this little trick to get unique titles on the index page when you click though the categories, so the title isn't the same on every page.

On the index.php page change the title line to:

<title><?php echo TITLE; ?> <?php echo $categories['categories_name']; ?> Online Catalog</title>

The $categories['categories_name']; var comes from the application top bread crumb trail. When you click through the categories on the index page it puts the category name into the title.

#2 stevemitch2

  • Community Member
  • 174 posts
  • Real Name:Steve
  • Location:Dorset, UK

Posted 15 March 2004, 18:46

This is a good tip, but, when you do this, for some reason even if you have input the page titles in capital letters, like: AMD BASE UNITS, it defaults at that page to read: Amd Base Units

Steve
Hope it helps...
PC Planet

#3 wondernet

  • Community Member
  • 296 posts
  • Real Name:David Hopkins
  • Gender:Male
  • Location:Bournemouth, Dorset, UK

Posted 15 March 2004, 18:59

Taking this one step further, using this code;
<title><?php echo TITLE; ?> : <?php echo HEADING_TITLE; ?> </title>
makes all the other pages take on the page 'title', or rather the text used in the breadcrumb navigation.

#4 wondernet

  • Community Member
  • 296 posts
  • Real Name:David Hopkins
  • Gender:Male
  • Location:Bournemouth, Dorset, UK

Posted 15 March 2004, 19:45

wondernet, on Mar 15 2004, 06:59 PM, said:

Taking this one step further, using this code;
<title><?php echo TITLE; ?> : <?php echo HEADING_TITLE; ?> </title>
makes all the other pages take on the page 'title', or rather the text used in the breadcrumb navigation.
However, this does not work on 'product_info.php' as the "HEADING_TITLE" is not used. Instead use;
<title><?php echo TITLE; ?> : <?php echo products_name; ?> </title>


#5 wondernet

  • Community Member
  • 296 posts
  • Real Name:David Hopkins
  • Gender:Male
  • Location:Bournemouth, Dorset, UK

Posted 15 March 2004, 20:03

Sorry guys, this last one didn't work, any suggestions??

#6 dburchm1

  • Community Member
  • 123 posts
  • Real Name:Dan Burch
  • Location:Gresham, Oregon, USA

Posted 17 March 2004, 00:00

On 'product_info.php' I installed the Header Tags Controller admin
http://www.oscommerce.com/community/contributions,207 and then used this code on the page

Quote

  if (isset($products_id)) {
$product_info = tep_db_query("select p.products_id, pd.products_head_title_tag, pd.products_head_desc_tag, pd.products_head_keywords_tag from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.language_id = '" . $languages_id . "'");
$product_info_values = tep_db_fetch_array($product_info);


}

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?> <?php echo $product_info_values['products_head_title_tag']; ?></title>
<meta name="keywords" content="<?php echo $product_info_values['products_head_keywords_ta"]; ?>">
<meta name="description" content="<?php echo $product_info_values['products_head_desc_ta"]; ?>">


on

#7 Alex Bath

  • Community Member
  • 21 posts
  • Real Name:Alex Bath
  • Location:London, England

Posted 18 March 2004, 12:51

Guys,

I achieved what you are looking for by doing this :

In application_top.php :

Around

Quote

require(DIR_WS_CLASSES . 'breadcrumb.php');
$breadcrumb = new breadcrumb;

Add

Quote

$page_title = '';

After

Quote

$breadcrumb->add($categories['categories_name'], tep_href_link(FILENAME_DEFAULT, 'cPath=' . implode('_', array_slice($cPath_array, 0, ($i+1)))));

Add

Quote

$page_title = $categories['categories_name'];

After

Quote

$breadcrumb->add($manufacturers['manufacturers_name'], tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']));

Add

Quote

$page_title = $manufacturers['manufacturers_name'];

Modify the model query to include products_name

Quote

$model_query = tep_db_query("select p.products_model, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.language_id = '" . $languages_id . "'");

Then after the breadcrumb ->add insert

Quote

$page_title = $model['products_name'];

Now in both default.php and product_info.php change

Quote

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

to

Quote

<title><?php echo TITLE; ?> - <?php echo $page_title; ?></title>

Its good, n'est pas?

#8 wondernet

  • Community Member
  • 296 posts
  • Real Name:David Hopkins
  • Gender:Male
  • Location:Bournemouth, Dorset, UK

Posted 18 March 2004, 13:02

Is actually pretty f*&%£!g brilliant.

Thanks.

#9 dburchm1

  • Community Member
  • 123 posts
  • Real Name:Dan Burch
  • Location:Gresham, Oregon, USA

Posted 18 March 2004, 16:03

Alex

Cool. I like that one because its soooo simple. Now no one has an excuse for not having a unique title on every page. I see a lot of nice graphic designs on OSC shops, but they have the same title on every page. If you go through the /catalog folder you can work on the titles on other page too.

I went through setting up the header tags controller contrib(above) because I wanted to have precise control on my titles, keyword and description meta tags on the product pages. It was a lot of work to go back through the catalog and set those all up and I don't have a lot of products. This is a great way for someone with a lot of products, who is looking for something quick and dirty to get unique titles. I think it really helps for search engine placement, especially google, to have unique titles. I can find a lot of google searches where my site comes up first or very high when people search for a specific product.

Dan

#10 Alex Bath

  • Community Member
  • 21 posts
  • Real Name:Alex Bath
  • Location:London, England

Posted 18 March 2004, 17:32

I'm glad you like it.

Dan,

While I admire your scrupulous attention to detail I rather fear that your hard work may have been in vain as I have it on good authority that few search engines these days use the meta tags during their indexing of your site. This was decided because of gross misuse by porn/viagra peddlers et al. The most recent articles that I have read indicate that the <title></title> tags are used and the page contents parsed for relevance. What is important is that the first few lines/paragraph contain the most relevant information about the page in question. Therefore it is important that you don't put a lot of "textural padding" like a disclaimer at the top of the page but put the most relevant information about your product there.

Hope that is of some assistance.

Regards
Alex.

#11 fmerrill

  • Community Member
  • 70 posts
  • Real Name:Frank Merrill

Posted 20 March 2004, 17:05

I can't generally disagree with the META issue, but keep in mind that there are SE's that do still use the description Meta under many circumstances.

Search on Yahoo for: electronic dart boards

Out of the top 4 listings (didn't look further), 1,2 and 4 have the Meta description tag, and that is what Yahoo displays as the description for the result. # 3 doesn't, because they don't have the Meta description at all.
#2 has actually changed their description since Yahoo crawled that pafge, and you'd need to look at the Yahoo cached version to see the description tag actually displayed currently in the results.

So, the Meta description IS a handy way to get the description you want in the search results.
Actually, if you look at those top 4 results, the description of the three with one looks much better than the one without it.

How useful is it actually for ranking? Who knows as Yahoo is a new animal, but Yahoos 'new' search technology will be powering Yahoo Search, AllTheWeb and Altavista, so I wouldn't yet discount that description Meta tag.

#12 normd

  • Community Member
  • 41 posts
  • Real Name:Norm Dallura
  • Location:Waynesboro, VA

Posted 22 March 2004, 03:46

I'm kinda new to OSC, so please bear with me. I made all the mods except one and titles are not appearing correctly - I still get the site name as the title. Can someone tell me where the default.php file is?

#13 fmerrill

  • Community Member
  • 70 posts
  • Real Name:Frank Merrill

Posted 22 March 2004, 04:52

If your new to osC then I'd guess that maybe you downloaded version 2.2(MS2)?
If so, there is no default.php, it's been renamed to index.php.

#14 Tarcris

  • Community Member
  • 3 posts
  • Real Name:Jmb

Posted 23 March 2004, 20:37

I do not understand what to do at these two steps -

Modify the model query to include products_name


QUOTE
$model_query = tep_db_query("select p.products_model, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.language_id = '" . $languages_id . "'");



Then after the breadcrumb ->add insert


QUOTE
$page_title = $model['products_name'];


Can you explain these 2 steps a little for me?

#15 Alex Bath

  • Community Member
  • 21 posts
  • Real Name:Alex Bath
  • Location:London, England

Posted 24 March 2004, 11:23

The model query originally does not include the column "products_name" and does not join with the table TABLE_PRODUCTS_DESCRIPTION, you need to modify the query as such. Search for the string "$model_query" in the file.

The breadcrumb trail is an object which is populated with values by calling the method called "add", search for the string "breadcrumb->add". You should add the new code "$page_title = $model['products_name'];" after this line.

Hope that helps.
(don't add the double-quotes, I just added those for annotation purposes)

Regards
Alex.

#16 glusniffer1

  • Community Member
  • 373 posts
  • Real Name:Mark Abell

Posted 25 March 2004, 13:28

I cant seem to get the code placed from Alex Bath's information..I keep getting a parse error when I place

Quote

$page_title = $model['products_name'];
In application_top.php...Just exactly where does this go?
The Hobby Undergound..."For The Pure Hobbyist"

#17 SeminoleFan

  • Community Member
  • 105 posts
  • Real Name:Rick Bedford

Posted 25 March 2004, 19:26

What would I add in index.php to get the same result as this below?

QUOTE
$page_title = $model['products_name'];

Now in both default.php and product_info.php change

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

to

QUOTE
<title><?php echo TITLE; ?> - <?php echo $page_title; ?></title>

Thanks
SeminoleFan

#18 mrjkb

  • Community Member
  • 93 posts
  • Real Name:John
  • Gender:Male
  • Location:Chicagoland

Posted 25 March 2004, 22:11

Speaking of titles.. do you guys know how to clean this up in my source:

<!-- Page layout by Simple Template System (STS) v2.01 on osCommerce 2.2-MS2 - http://www.diamondsea.com/sts/ -->
<!-- Using Template File [includes/sts_template.html) -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- BOF: Generated Meta Tags -->
<title> Find Barcode Labels, Barcode Printers, Thermal Transfer Labels and Zebra Printers Here! </title>
<META NAME="Description" Content="Purchase Barcode Printers, Barcode Labels, Thermal Transfer Labels, and Zebra Printers at AdaZon. ">
<META NAME="Keywords" CONTENT=" barcode printers, barcode labels, zebra printers, thermal transfer labels, thermal transfer printers, barcode scanners, Sato printers, datamax printers, intermec scanners, symbol scanners, thermal transfer ribbons, barcode ribbons">
<!-- EOF: Generated Meta Tags -->

I have 2 contributions added. One is STS and the other is Header Tag Controller. The title><title has an unwanted space in front and behind the actual words. I cannot get rid of them. I also want the title to be right under the <head> Is that possible?
Laser labels, barcode labels, custom labels

#19 ssierra1

  • Community Member
  • 11 posts
  • Real Name:Sara Sierra
  • Gender:Female

Posted 29 March 2004, 19:39

[quote name='Alex Bath' date='Mar 18 2004, 12:51 PM'] Guys,

I achieved what you are looking for by doing this :

In application_top.php :

Around

[quote]require(DIR_WS_CLASSES . 'breadcrumb.php');
$breadcrumb = new breadcrumb;[/quote]

Add

[quote]$page_title = '';[/quote]

After

[quote]$breadcrumb->add($categories['categories_name'], tep_href_link(FILENAME_DEFAULT, 'cPath=' . implode('_', array_slice($cPath_array, 0, ($i+1)))));[/quote]

Add

[quote]$page_title = $categories['categories_name'];[/quote]

After

[quote]$breadcrumb->add($manufacturers['manufacturers_name'], tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']));[/quote]

Add

[quote]$page_title = $manufacturers['manufacturers_name'];[/quote]

Modify the model query to include products_name

[quote]$model_query = tep_db_query("select p.products_model, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.language_id = '" . $languages_id . "'");[/quote]

Then after the breadcrumb ->add insert

[quote]$page_title = $model['products_name'];[/quote]

Now in both default.php and product_info.php change

[quote]<title><?php echo TITLE; ?></title>[/quote]

to

[quote]<title><?php echo TITLE; ?> - <?php echo $page_title; ?></title>[/quote]

Its good, n'est pas? [/quote]
Hello,
I am using ms2 max can you tell me where I would find this in ms2 max

Now in both default.php and product_info.php change

[quote]<title><?php echo TITLE; ?></title>[/quote]

to

[quote]<title><?php echo TITLE; ?> - <?php echo $page_title; ?></title>[/quote]

I looked in the index.php and product_info.php and cannot find this.

Thank you <_<

#20 Ethan1701

  • Community Member
  • 173 posts
  • Real Name:Ethan
  • Location:Israel

Posted 31 March 2004, 00:10

I implemented Alex's idea, and it works great, with one exception: when on the front page, instead of the title being 'MYSTORE', it is now 'MYSTORE - '.
In order to fix this, make the following small changes:

Whereever you added $page_title, such as

Quote

$page_title = $manufacturers['manufacturers_name'];
replace it with

Quote

$page_title = $manufacturers['manufacturers_name'].' - ';
And then, in Index.php and in product_info.php, place the following:

Quote

<title><?php echo TITLE; ?><?php echo $page_title; ?></title>
or better yet,

Quote

<title><?php echo TITLE.$page_title; ?></title>
(Though I haven't tried the second option, in ought to work)

This way, the hyphen is part of the variable, and isn't displayed when not needed.

-Ethan

Edited by Ethan1701, 31 March 2004, 00:10.