Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

page title info in 4.4.x

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 10-31-2010, 02:34 PM
 
digiemp digiemp is offline
 

Senior Member
  
Join Date: Aug 2007
Posts: 192
 

Default 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.
__________________
version 4.4.2
Reply With Quote
  #12  
Old 11-01-2010, 10:03 AM
 
peddler peddler is offline
 

Senior Member
  
Join Date: May 2007
Posts: 140
 

Default 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
__________________
Ralph
X-Cart v4.4.2 Gold (still buggy, some are new ones)
PHP 5.2.13
Reply With Quote
  #13  
Old 12-08-2010, 09:14 PM
 
digiemp digiemp is offline
 

Senior Member
  
Join Date: Aug 2007
Posts: 192
 

Default 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.
__________________
version 4.4.2
Reply With Quote
  #14  
Old 12-09-2010, 11:05 AM
 
peddler peddler is offline
 

Senior Member
  
Join Date: May 2007
Posts: 140
 

Default 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!

.
__________________
Ralph
X-Cart v4.4.2 Gold (still buggy, some are new ones)
PHP 5.2.13
Reply With Quote
  #15  
Old 03-16-2011, 08:12 AM
  proboscidian's Avatar 
proboscidian proboscidian is offline
 

Senior Member
  
Join Date: May 2005
Location: Clearwater, FL
Posts: 146
 

Default 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?
__________________
Industrial Webworks
Various xcart versions from 4.1.19 gold - 4.7 gold
http://www.industrialwebworks.net
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

   

 
X-Cart forums © 2001-2020