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

Optimizing Page Title Text

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 06-29-2003, 11:22 AM
 
walteis walteis is offline
 

Advanced Member
  
Join Date: Jan 2003
Location: USA
Posts: 65
 

Default Optimizing Page Title Text

From what I've read, extra spaces or non-displaying characters (like CR or LF) make search engines unhappy, so to speak. I've noticed that x-cart seems to put some of those in there however.

The following smarty 2.5.x code will fix that problem. Add to customer/home.tpl
Code:
{assign var="loc" value=" "} {if $main eq "catalog"} {if $location eq ""} {assign var="loc" value=$lng.txt_subtitle_home|strip} {else} {section name=index loop=$location} {assign var="loc" value=$loc|cat:" - "} {assign var="loc" value=$loc|cat:$location[index].0|strip} {/section} {/if} {elseif $main eq "product"} {assign var="loc" value=" - "|cat:$product.product|strip|default:""} {elseif $main eq "help"} {assign var="loc" value=$lng.txt_subtitle_help} {elseif $main eq "cart"} {assign var="loc" value=$lng.txt_subtitle_cart} {elseif $main eq "checkout"} {assign var="loc" value=$lng.txt_subtitle_checkout} {elseif $main eq "order_message"} {assign var="loc" value=$lng.txt_subtitle_thankyou} {/if} <title>{$lng.txt_site_title}{$loc}</title>

Walt
Reply With Quote
  #2  
Old 04-05-2004, 01:46 AM
 
phpguy phpguy is offline
 

Member
  
Join Date: Apr 2004
Posts: 17
 

Default

Hey, thanks for posting that code Walt. Am I the only one in four months to make use of it?

BTW, if anyone else has tried this, do you also get alot of spaces generated in the output source code between the </head> and <title> tags? I do, is this going to be of a problem to spiders?
Reply With Quote
  #3  
Old 05-29-2004, 10:10 PM
 
GM GM is offline
 

eXpert
  
Join Date: Mar 2004
Location: Canada
Posts: 293
 

Default

Hmmmm... I wonder if this works? Looks good, little bit scared to try it, but always like to improve. Thanks walteis nice post.
__________________
v. 4.0.14 (GM Style)
O.S. Linux
Build Your Own Diamond Ring
Reply With Quote
  #4  
Old 05-30-2004, 03:54 AM
  TelaFirma's Avatar 
TelaFirma TelaFirma is offline
 

X-Adept
  
Join Date: Nov 2002
Location: North Carolina USA
Posts: 930
 

Default

Or you could just take your existing code for the title tag and add the {strip} tag. This tag strips out all the extra line feeds in HTML.

Example from 3.5.x:

Code:
{strip} <title>{$lng.txt_site_title} {if $main eq "catalog"} {if $location eq ""} {$lng.txt_subtitle_home} {else} {strip} {section name=position loop=$location start=0 } {if %position.last% eq "true"} - {$location[position].0|escape}{/if} {/section} {/strip} {/if} {elseif $main eq "product"} {if $product.product ne ''} - {$product.product}{/if} {elseif $main eq "help"} {$lng.txt_subtitle_help} {elseif $main eq "cart"} {$lng.txt_subtitle_cart} {elseif $main eq "checkout"} {$lng.txt_subtitle_checkout} {elseif $main eq "order_message"} {$lng.txt_subtitle_thankyou} {elseif $main eq "wishlist"} {$lng.txt_subtitle_wishlist} {elseif $main eq "giftcert"} {$lng.txt_subtitle_giftcerts} {/if} </title> {/strip}
Reply With Quote
  #5  
Old 05-31-2004, 02:44 PM
 
xcell67 xcell67 is offline
 

Senior Member
  
Join Date: Dec 2003
Posts: 149
 

Default

telafirma,
your code causes {/strip} to be displayed on the home page, I tried moving it before </title> but then it causes {/strip} to be added onto the title of the page ie X-cart Books {/strip}

is there an easier way or did i read the code wrong?
Reply With Quote
  #6  
Old 06-01-2004, 03:09 AM
  TelaFirma's Avatar 
TelaFirma TelaFirma is offline
 

X-Adept
  
Join Date: Nov 2002
Location: North Carolina USA
Posts: 930
 

Default

oops... my fault. I failed to take into account the {strip} tags that were already in the code.

Try this:
Code:
{strip} <title>{$lng.txt_site_title} {if $main eq "catalog"} {if $location eq ""} {$lng.txt_subtitle_home} {else} {section name=position loop=$location start=0 } {if %position.last% eq "true"} - {$location[position].0|escape}{/if} {/section} {/if} {elseif $main eq "product"} {if $product.product ne ''} - {$product.product}{/if} {elseif $main eq "help"} {$lng.txt_subtitle_help} {elseif $main eq "cart"} {$lng.txt_subtitle_cart} {elseif $main eq "checkout"} {$lng.txt_subtitle_checkout} {elseif $main eq "order_message"} {$lng.txt_subtitle_thankyou} {elseif $main eq "wishlist"} {$lng.txt_subtitle_wishlist} {elseif $main eq "giftcert"} {$lng.txt_subtitle_giftcerts} {/if} </title> {/strip}
Reply With Quote
  #7  
Old 06-01-2004, 02:17 PM
 
xcell67 xcell67 is offline
 

Senior Member
  
Join Date: Dec 2003
Posts: 149
 

Default

eh xa lent, thanks telafirma, worked beautifully
Reply With Quote
  #8  
Old 06-03-2004, 06:45 PM
 
matt.currie matt.currie is offline
 

Newbie
  
Join Date: May 2004
Location: Nanaimo, B.C. Canada
Posts: 4
 

Default

TelaFirma: Thanks for taking the time to post! worked excellent. It was high on my list of 'mods' that shockingly are not included in the X-Cart package.

Matt
Curtek Systems - http://www.curtek.com
Reply With Quote
  #9  
Old 06-28-2004, 09:05 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

Very handy, thanks for sharing.
Reply With Quote
  #10  
Old 06-29-2004, 07:48 AM
 
Risky Risky is offline
 

Member
  
Join Date: Jan 2004
Posts: 26
 

Default

I'm sorry to ask, but for the very lay shop owners amongst us, can you just briefly explain in plain language what this bit of code achieves.

It's got pretty good reviews, so I'm sure it's a worthy mod to adopt, but it would greatly help if I could understand exactly what effect it has on the store's appearance or workings.

Thanks in advance,
__________________
Risky
V3.5.3
With Options-based inventory tracking mod, by X-cart
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 02:46 AM.

   

 
X-Cart forums © 2001-2020