Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

dynamic page titles... ?!?


dreamscape

Recommended Posts

Posted

hello...

 

I would like to make my page titles dynamic. I have come up with something for default.php that shows:

 

Site name | Category name or Manufacture name(if customer is browsing by manufacture instead of by category)

 

but I am having trouble with product_info.php... I want the title on product info to show:

 

Site name | Category name | Product name

 

I cannot for the life of me figure out what will give me the product name in the title...

 

is there anyone using dynamic titles, and if so could you give me some pointer?? I want dynamic titles #1 for customer ease of use and #2 for search engines, so that I don't have a bunch of links to my site on search engines with only the site name in them, especially if the link is to a product... it just makes more sense than having every single page show the same title.

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Posted

Might peek at the Header Tags Controller that I wrote on what I used to handle this.

 

Richard wrote an Admin for me as well.

Posted

great... I'll take a look at it as soon as I can access your site (it seems to be down at the moment?)

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Posted

Unfortunately it is ... :(

 

Fortunately, this Add-On is also in the Contributions section :D

 

Naturally I am in the middle of fixing two sites for people both of which I downloaded to my site to work on.

 

I think servers die proportional to how much you are trying to catch up on work by doing the all nighter thang :roll:

Posted

I was looking for something else in the Contributions list and saw this one for you, Joshua. I believe it's called Breadcrumb Trail Title. The description sounds like what you want.

Posted

ah thanks...

 

I see it adds new information to the database... not really what I was looking for since I add my products via EasyPopulate... I was looking for something that used the information already in the database.

 

thanks anyways though

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

  • 1 year later...
Posted

Dreamscape,

 

Seems like you have solved the dynamic titles problem.Would you share your solution with us.

 

Buy the way, in your site, the php pags did not show as .php file. It just end as the file name. I think this is cool. Would you share this with us too?

 

This is a old thread, I don't mind if you could not see it.

Posted

The Header Tag Controller that they were discussing is available in the contributions section (link at the top of this page in the gray bar).

 

AFAIK, he manually set up mod rewrite to go to the various links. You can also look at the YASU contribution for similar functionality.

 

Hth,

Matt

Always back up before making changes.

  • 4 weeks later...
Posted

hi,

 

i have got a problem with the yasu contribution. When i go on my website in a product description, i can see in the "the title gray bar" :

 

ex: home page=>soap=>coconut soap

 

if i click once, in the box languages on the French flag:

 

i see that in the gray bar:

 

page d'acceuil => savon => coconut soap
!!!!

 

if a click twice, on the french flag, all is ok en frenh :angry:

 

and if the same problem if i try with an other flag.

 

i search and i know, now, that this problem is in this file: catalog\include\function\html_output.php.

 

i changed the following lines (around 34-6 of includes/functions/html_output.php):

 

like in the install.txt file

 

 

if (tep_not_null($parameters)) {

      $link .= $page . '?' . tep_output_string($parameters);

      $separator = '&';

 

by

 

separator = '?';

    if (tep_not_null($parameters)) {

      $product_name = '';

      switch ($page) {

        case FILENAME_PRODUCT_INFO:

        case FILENAME_DEFAULT:

          $manufacturer_name = '';

          $product_name = '';

          $new_parameter_list = array();

          $cPath_list = array();

          foreach (explode('&', $parameters) as $pair) {

            global $languages_id;

            $pair_array = explode('=', $pair);

            switch ($pair_array[0]) {

              case 'action':

                $link .= $page . '?' . tep_output_string($parameters);

                $separator = '&';

                break 3;

              case 'cPath':

                $parent_id = 0;

                foreach (explode('_', $pair_array[1]) as $category_id) {

                  $category_name_query = tep_db_query("select cd.categories_name from categories_description cd, categories c where cd.categories_id=c.categories_id and cd.categories_id='" . (int)$category_id . "' and cd.language_id='" . (int)$languages_id . "' and c.parent_id='" . (int)$parent_id . "'");

                  if ($category_name_array = tep_db_fetch_array($category_name_query)) {

                    $cPath_list[]= urlencode($category_name_array['categories_name']);

                    $parent_id = $category_id;

                  }

                }

                break;

              case 'products_id':

                $product_name_query = tep_db_query("select products_name from products_description where products_id='" . (int)$pair_array[1] . "' and language_id='" . (int)$languages_id . "'");

                if ($product_name_array = tep_db_fetch_array($product_name_query)) {

                  $product_name = $product_name_array['products_name'];

                }

                break;

              case 'manufacturers_id':

                $manufacturer_name_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id='" . (int)$pair_array[1] . "'");

                if ($manufacturer_array = tep_db_fetch_array($manufacturer_name_query)) {

                  $manufacturer_name = $manufacturer_array['manufacturers_name'];

                }

                break;

              case '':

                break;

              default:

                if (tep_not_null($pair)) $new_parameter_list[]= $pair;

            }

          }

          if (tep_not_null($manufacturer_name)) {

            $cPath_list[]= urlencode($manufacturer_name);

          }

          if (tep_not_null($product_name)) {

            $cPath_list[]= urlencode($product_name);

          }

          $separator = '?';

          $link .= preg_replace('/%2F/', '%20', implode('/', $cPath_list));

          if (tep_not_null($new_parameter_list)) {

            $link .= $separator . implode('&', $new_parameter_list);

            $separator = '&';

          }

          break;

        default:

          $link .= $page . '?' . tep_output_string($parameters);

          $separator = '&';

      }

 

Note that both before and after making the changes, the next lines would be:

 

    } else {

      $link .= $page;

      $separator = '?';

    }

 

and now i have got this problem, if i come back, no problem.

 

 

Do you know what 's line, i can change for to solve my problem ??

 

 

SORRY FOR MY ENGLISH

  • 1 month later...

Archived

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

×
×
  • Create New...