X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   page title info in 4.4.x (https://forum.x-cart.com/showthread.php?t=56149)

digiemp 10-31-2010 02:34 PM

Re: page title info in 4.4.x
 
Quote:

Originally Posted by peddler
You can put whatever text you want in place of "Your Domain Name". e.g. "The Donut Hole - the hole truth and nothing but!" But it will show as part of the title on EVERY page!


Is there a way to add something to every page EXCEPT the home page?

I have the home page title as I want it. But the product or category page titles are simply "Product" or "Category" where "Product" is the actual name of the product in question. I can alter the category title and force that on every product in the category, but that's not really the proper solution.

What I would like is to be able to hard code part of the title tag to appear after whatever title I type into the appropriate text box under SEO Options.

So if on the 'glazed doughnut' page the title would read "Glazed Doughnut - Doughnuts.com". Or if in the 'cream filled' category the page title would read "Cream Filled - Doughnuts.com" or whatever. Currently if on the 'glazed doughnut' page the title is simply "Glazed Doughnut".

My site that used 4.1.8 did this with no additional coding so I know it is possible.

peddler 11-01-2010 10:03 AM

Re: page title info in 4.4.x
 
Quote:

My site that used 4.1.8 did this with no additional coding so I know it is possible.

Yeah, but 4.1.8 used a simple coding technique within the home.tpl file. With 4.4.1, there's a whole different approach, not the least of which is the 7KB file, function.get_title.php. Are you looking to do this without "additional coding", cuz you also wrote "I would like is to be able to hard code" ?? I'm a bit confused on that. It will take a coding change to make what you want.

Quote:

I have the home page title as I want it.

How did you do that? Did you hard-code a tpl file? If so, then a code change to the function.get_title.php file shouldn't affect your home page title. I can't say for certain without knowing how you coded it.

Refer to my post #1 and instead of using this line of code:

Code:

$title = str_replace("Home", "Your Domain Name", $title);


Use this:

Code:

$title = trim($title) .' - Your Domain Name' ;


Format that bit, - Your Domain Name , however you wish; whatever you want to put between the single-quote marks. (remember to verify that your home page title is un-changed)



Your final code will look like this:

Code:

    // truncate
    $title = str_replace(" ", " ", $title);

  // title mod
    $title = trim($title) .' - Your Domain Name' ;
  // end title mod


    if (strlen($title) > $config['SEO']['page_title_limit'] && $config['SEO']['page_title_limit'] > 0) {
        $title = func_truncate($title, $config['SEO']['page_title_limit']);
    }

    // escape


digiemp 12-08-2010 09:14 PM

Re: page title info in 4.4.x
 
Okay, I finally got around to doing this. It definitely works, but it changes EVERY page, including the homepage. It is probably fine to add it to the homepage as well but I thought you should know the outcome.

Thanks again.

peddler 12-09-2010 11:05 AM

Re: page title info in 4.4.x
 
Quote:

Originally Posted by digiemp
Okay, I finally got around to doing this. It definitely works, but it changes EVERY page, including the homepage. It is probably fine to add it to the homepage as well but I thought you should know the outcome.

Thanks again.



Look back over post #8, it checks for the Homepage and allows its title to be whatever you want it to be, and then you can set the title for all other pages.

I understood you to want the categories and product page titles to show their name first, followed by your domain name - that would be the opposite of the layout shown in post #8. To get what you want, just use the code I gave in my previous post and include it in post #8's code. Like this:

Code:

$title = end($tmp);


    // truncate
    $title = str_replace(" ", " ", $title);
  if ($title == 'Home') {
    $title = str_replace("Home", "Your Domain Name", $title); } else {
    $title = trim($title) .' - Your Domain Name' ;
  }
    }


If that isn't what you meant, then I'm confused. And it won't be the first time for that! :D

.

proboscidian 03-16-2011 08:12 AM

Re: page title info in 4.4.x
 
One of my customers just asked me to generate titles and descriptions like this:

TITLE
Manufacturer - SKU - Category - Company

DESCRIPTION
COMPANY has been serving the electrical industry since 1992. Low prices. Purchase SKU today! With over 30 years providing MANUFACTURER products and others we can help with your CATEGORY needs (etc. etc., there is a lot of garbage text to insert)

Any idea on how to do this?


All times are GMT -8. The time now is 01:30 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.