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)
-   -   How to Change the X-cart title code... (https://forum.x-cart.com/showthread.php?t=14734)

sbtiti 06-22-2005 12:11 PM

How to Change the X-cart title code...
 
Without it changing other aspects of my cart?

I tried adding it directly into the "Company name" field, but then it appears on the navigation tree and probably other places that I didn't notice. I want to add a slogan after the domain name so it looks like this:

domain.com - slogan

and when viewing the product pages or any other Xcart page that places text after the domain I want the slogan to be in there right after the domain.

I tried playing with this code in home.tpl:

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}
{else}
{section name=position loop=$location step=-1}
{$location[position].0|escape}
{if not %position.last%} :: {/if}
{/section}
{/if}
</TITLE>


but it never would put it in the right spot or it would appear twice. How do I get my slogan to appear after the domain name, but still include the default category and product title code after the slogan on those pages, while only the domain name and slogan appear on home.php?

Can somebody please help?

Thanks!

Bella Forma 06-22-2005 02:10 PM

I set up a language variable called $lng.lbl_seo_title which I put my slogan in.

Then put it right after the last {/section} like this:

Quote:


{strip}<TITLE>
{if $config.SEO.page_title_format eq "A"}
{strip}{section name=position loop=$location}
{$location[position].0|escape}
{if not %position.last%} - {/if}
{/section}{/strip}
{else}
{strip}{section name=position loop=$location step=-1}
{$location[position].0|escape}
{if not %position.last%} - {/if}
{/section}
{$lng.lbl_seo_title}{/strip}
{/if}
</TITLE>{/strip}


sbtiti 06-27-2005 09:16 AM

How do I create a "language variable"?

hooter 06-27-2005 09:32 AM

Quote:

Originally Posted by sbtiti
How do I create a "language variable"?


Xcart Administration -> Languages -> Edit Language (select your default language from pulldown) -> Select topic (Label, Text, E-mail, Errors, Languages, Countries) -> Add your own variable using the text input boxes below "Add new entry" -> Apply changes

sbtiti 06-27-2005 11:08 AM

Didn't work. Created the "language variable" called "lbl_seo_title" with the slogan and put this into the home.tpl:

Code:

{strip}<TITLE>
{if $config.SEO.page_title_format eq "A"}
{strip}{section name=position loop=$location}
{$location[position].0|escape}
{if not %position.last%} - {/if}
{/section}{/strip}
{else}
{strip}{section name=position loop=$location step=-1}
{$location[position].0|escape}
{if not %position.last%} - {/if}
{/section}
{$lng.lbl_seo_title}{/strip}
{/if}
</TITLE>{/strip}


but it didn't show any slogan in any of the titles.

Bella Forma 06-27-2005 01:47 PM

Hmmm strange definately works for me and I can't remember making any other changes. Only difference is your on a different version but the original code looks exactly the same as mine.

Did you navigate further into the store than the home page? The home page title will still be controled by the index.html page but once you get past that the lbl_seo_title takes over.

I set my language variable up as a Label. No idea if this makes a difference (I wouldn't have thought so) but worth checking and changing if your is different.

sbtiti 06-29-2005 11:45 AM

OK I tried it again and here's what I did / happened:

Here's my original code:

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}
{else}
{section name=position loop=$location step=-1}
{$location[position].0|escape}
{if not %position.last%} :: {/if}
{/section}
{/if}
</TITLE>


As per your instructions I added the line:

Code:

{$lng.lbl_seo_title}{/strip}
after the section code and I added the strip code after the /title code so that it ended up looking like this:

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}
{else}
{section name=position loop=$location step=-1}
{$location[position].0|escape}
{if not %position.last%} :: {/if}
{/section}
{$lng.lbl_seo_title}{/strip}
{/if}
</TITLE>{/strip}


It looks like my code differs from yours slightly, I don't have the strip code before the title and a few other smaller things.

Here's the error I get when using that code:

Code:

Fatal error: Smarty error: [in customer/home.tpl line 19]: syntax error: mismatched tag {/strip}. expected {/else} (opened line 14). (Smarty_Compiler.class.php, li in /home/gmgadmin/public_html/cart/Smarty-2.6.3/Smarty.class.php on line 1082

If I remove the two strip codes then the frontpage (home.php) finally came up, but there is no slogan appearing in the browser title on home.php or any other page. I did recreate the langauge entry as a label before all of this.

Do you have any more ideas of how I can get this to work?

Bella Forma 07-05-2005 05:16 PM

Sorry only just come back to this post. Did you finally get it working?

If not the error message is telling you that you need to place the strip code before the title (as well as after)

Remember commands like that always come in pairs so if you miss an opening or closing tag from the pair then you will get a 'mismatch' type error.

GriffithLea 07-08-2005 02:01 PM

Hi, this mod interests me, as I too want to append a phrase to the Company Name (i.e. that which is specified in General Settings -> Company Options) but only in the TITLE section of the HTML source. Is that what your mod does? Can you give me a quick explanation of how it works, so I can be sure that it's what I want before I implement it? I'd really appreciate it.

Bella Forma 07-08-2005 07:08 PM

Yes that's exactly what this mod does. Easiest way to see what it does is to implement it as it's a very minor mod and easily changed back if you don't like it.

I can't claim any credit for it though, it was something I picked up from another post on these forums:

http://forum.x-cart.com/viewtopic.php?t=9907&highlight=title+strip


All times are GMT -8. The time now is 12:07 AM.

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