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

Display Only Current Page in Page Title

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 02-09-2006, 12:57 AM
 
TJ Stephens TJ Stephens is offline
 

Advanced Member
  
Join Date: May 2005
Location: California
Posts: 94
 

Default Display Only Current Page in Page Title

I am not sure if this is worthy to be in the custom mods section but I will post anyway since I could not find a clean way to do this on the forum.

Xcart currently gives you only two options for page title format: (1) "Shop Name :: Category Name :: Product Name," or (2) "Product Name :: Category Name :: Shop Name." This mod adds a third option called "Current Page Only" which displays only the current page you are viewing. Some people claim this helps with SEO.

For example, if you are on the home page, it will display your site name as the page title, if you are viewing a category, it will display the category and nothing else, and if you are viewing a product then it will display the product name and nothing else, etc...

First, edit skin1/admin/configuration.tpl and find the following code:

Code:
{elseif $configuration[cat_num].name eq "page_title_format"} <SELECT name="{$configuration[cat_num].name}"> <OPTION value="A" {if $configuration[cat_num].value eq "A"}selected{/if}>Shop name :: Category name :: Product name</OPTION> <OPTION value="D" {if $configuration[cat_num].value eq "D"}selected{/if}>Product name :: Category name :: Shop name</OPTION> </SELECT>

Then add the following line after the last option:

Code:
<OPTION value="G" {if $configuration[cat_num].value eq "G"}selected{/if}>Current Page Only</OPTION>

Then edit skin1/customer/home.tpl and replace everything between the <TITLE> tags with the following:

Code:
<TITLE> {if $config.SEO.page_title_format eq "A"} {section name=position loop=$location} {$location[position].0|escape} {if not %position.last%} :: {/if} {/section} {elseif $config.SEO.page_title_format eq "D"} {section name=position loop=$location step=-1} {$location[position].0|escape} {if not %position.last%} :: {/if} {/section} {elseif $config.SEO.page_title_format eq "G"} {section name=position loop=$location} {if %position.last%}{$location[position].0|escape}{/if} {/section} {/if} </TITLE>

Finally, make sure that you have selected "Current Page Only" in the admin area under General Settings --> SEO Options --> Page Title Format. This was done in 4.0.14. It may be different in other versions but you get the idea. Hope that helps.

T.J.
__________________
X-Cart Pro 4.1.11 (Live)
XRMA
XAFF
XAOM
DSEFU Pro
XGift Reg
Firetank Feed Manager
BCSE Shipping Calculator
XcartMod Dynamic Images
Reply With Quote
  #2  
Old 03-02-2006, 05:02 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default

Just thought I'd say thanks for this mod... makes absolute sense for SEO.
__________________
xcartmods.co.uk
Reply With Quote
  #3  
Old 05-26-2006, 11:54 PM
 
cotc2001 cotc2001 is offline
 

X-Man
  
Join Date: Feb 2003
Location: Shrewsbury, UK
Posts: 2,351
 

Default

Works great, one question though
Because say for example the help pages are essentially the same page but with just different language variables controlled by the appending variable in the url string, how would I stop it from displaying the same title tag all the way through.

In my home.tpl i used to have

Code:
{elseif $main eq "product"}{if $product.product ne ''}{$product.product} | {if $current_category.page_title eq ""}:{$current_category.category_name|regex_replace:"/.*\//":""}:{$config.Meta.site_title}{else}{$current_category.page_title}{/if}{/if} {elseif $main eq "registration_landing"}User Registration - Just Hom Mens Underwear {elseif $main eq "faqs"}Frequently Asked Questions - Just Hom Mens Underwear {elseif $main eq "fts_sitemap"}Site Map - Just Hom Mens Underwear {elseif $main eq "site_map"}Links - Just Hom Mens Underwear {elseif $main eq "reviews_list"}Product Reviews - Just Hom Mens Underwear {elseif $main eq "feedback"}Feedback - Just Hom Mens Underwear {elseif $help_section eq "business"}Privacy Policy - Just Hom Mens Underwear {elseif $help_section eq "about"}Delivery - Just Hom Mens Underwear {elseif $help_section eq "returns"}Returns and Refunds - Just Hom Mens Underwear {elseif $help_section eq "conditions"}Terms and Conditions - Just Hom Mens Underwear {elseif $help_section eq "contactus"}Contact Just Hom {elseif $main eq "help"}Help Section - Just Hom Mens Underwear

After the last {if} statement but if I try to input that with this i just get a blank page.
__________________
x-cart 4.0.5 (live and heavily modded)
Server: freebsd
Reply With Quote
  #4  
Old 05-27-2006, 10:27 PM
 
TJ Stephens TJ Stephens is offline
 

Advanced Member
  
Join Date: May 2005
Location: California
Posts: 94
 

Default

You should be able to add the variables for the help pages in between the {/section} and {/if} in the code below:
Code:
{elseif $config.SEO.page_title_format eq "G"} {section name=position loop=$location} {if %position.last%}{$location[position].0|escape}{/if} {/section} {INSERT OTHER IF STATEMENTS HERE} {/if}
Let me know if that works.
__________________
X-Cart Pro 4.1.11 (Live)
XRMA
XAFF
XAOM
DSEFU Pro
XGift Reg
Firetank Feed Manager
BCSE Shipping Calculator
XcartMod Dynamic Images
Reply With Quote
  #5  
Old 05-29-2006, 01:14 AM
 
cotc2001 cotc2001 is offline
 

X-Man
  
Join Date: Feb 2003
Location: Shrewsbury, UK
Posts: 2,351
 

Default

Its ok I sorted it easy enough - i'll put it down to a case of being totally knackered.

One thing i've lost (which may of happend well before this) is the ability to have the page title that is entered in static pages shown - at the moment it just displays the default title of "HOM underwear" , anyone have the code to hand before I sift through the defaut x-cart distro for it.
__________________
x-cart 4.0.5 (live and heavily modded)
Server: freebsd
Reply With Quote
  #6  
Old 06-19-2006, 01:27 PM
 
jdedba jdedba is offline
 

Advanced Member
  
Join Date: Dec 2004
Posts: 96
 

Default

Version 4.1.1 is different. I do not see skin1/admin/configuration.tpl file. There is a configuration.tpl file in skin1/admin/main. But it does not have the code for the title format dropdown. Does anyone know where to find the code in 4.1.1?

One way to workaround is just using
Code:
<title> {section name=position loop=$location} {if %position.last%}{$location[position].0|escape}{/if} {/section} </title>
to replace
Code:
<title> {if $config.SEO.page_title_format eq "A"} {section name=position loop=$location} {$location[position].0|strip_tags|escape} {if not %position.last%} > {/if} {/section} {else} {section name=position loop=$location step=-1} {$location[position].0|strip_tags|escape} {if not %position.last%} :: {/if} {/section} {/if} </title>
in home.tpl.

Thanks for sharing.
__________________
version 4.1.1
Reply With Quote
  #7  
Old 02-24-2007, 11:09 AM
  newattraction's Avatar 
newattraction newattraction is offline
 

Member
  
Join Date: Oct 2006
Posts: 17
 

Default Re: Display Only Current Page in Page Title

For version 4.1.6, there's no need to change configuration.tpl. Just add an option "G: Current Page Only" to cell titled "page_title_format" in xcart_config table (around page 5) using phpMyAdmin, and select this option G from backend Admin.
__________________
www.vonbell.com
xcart v4.1.6
Reply With Quote
  #8  
Old 03-06-2007, 08:54 PM
  newattraction's Avatar 
newattraction newattraction is offline
 

Member
  
Join Date: Oct 2006
Posts: 17
 

Default Re: Display Only Current Page in Page Title

Don't forget, if you use Fast Lane Checkout in version 4.1.x, this file should also be modified: \skin1\modules\Fast_Lane_Checkout\home.tpl.
__________________
www.vonbell.com
xcart v4.1.6
Reply With Quote
  #9  
Old 03-06-2007, 09:12 PM
  mitash's Avatar 
mitash mitash is offline
 

X-Adept
  
Join Date: Jan 2006
Location: Australia
Posts: 450
 

Default Re: Display Only Current Page in Page Title

Nice mod...I would recommend Produt Meta tags and Titel Tags Plus from BCSE!
__________________
eCommerce - Strategy / Design / Development / Marketing / Maintenance

Call within Australia:
Phone: 1300 648 274 | Mobile: 0417 241 950
Call outside Australia:
+61 417 241 950 |

Email:
results@mitash.com | Skype: mitashau | Web: www.mitash.com
Reply With Quote
  #10  
Old 03-06-2007, 09:13 PM
  mitash's Avatar 
mitash mitash is offline
 

X-Adept
  
Join Date: Jan 2006
Location: Australia
Posts: 450
 

Default Re: Display Only Current Page in Page Title

Gives you the liberty to add cutom titles etc.... excellent for SEO
__________________
eCommerce - Strategy / Design / Development / Marketing / Maintenance

Call within Australia:
Phone: 1300 648 274 | Mobile: 0417 241 950
Call outside Australia:
+61 417 241 950 |

Email:
results@mitash.com | Skype: mitashau | Web: www.mitash.com
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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:31 PM.

   

 
X-Cart forums © 2001-2020