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)
-   -   if language english show this (https://forum.x-cart.com/showthread.php?t=45186)

Oktane Design 01-29-2009 09:33 AM

if language english show this
 
Hello guys,

I would like to have a code like this :

{if $language eq "US"}english text</if>
{if $language eq "FR"}french text</if>

Thanks

Asiaplay 01-29-2009 11:57 AM

Re: if language english show this
 
Hi again,

If this is being used just for displaying text alone???.. then you are better to just add a new "language variable" in X-Cart...
In X-Cart Admin choose -> Languages
Then...
a) select the language you want to work on, from the drop-down box e.g. English
b) go to the bottom of the languages page and choose to "add" a language variable e.g. lbl_my_new_language_variable (hint - I use lbl_z_my_new_language_variable , so I can tell which language tags have been manually added by me)...
c) then change to an alternative language using the drop down box at top e.g. Japanese
c1) and search / filter looking for... lbl_my_new_language_variable ...
c2) then input the text in Japanese for example, that matches the English you have translated and click the "update all" button.
Note: you can use html in language tags - so this method can be used for url links as well, as I understand.

Then in your php template code, use "lng.lbl_my_new_language_variable" (without the quotes) to reference that text / language variable tag... then you will see the text you want appear, as the language(s) changes.

Hope comments help - cheers, Asiaplay

Oktane Design 01-29-2009 12:01 PM

Re: if language english show this
 
Thank you Asianplay, but that's not what i need.

instead of having a language variable for the welcome text on the home page i want to create something like this :

{if $language eq "US"}{include file="pages/US/home_page.html" }</if>
{if $language eq "FR"}{include file="pages/FR/home_page.html" }</if>

On this way i will be able to change the welcome page with the static page.

thanks

Asiaplay 01-29-2009 01:04 PM

Re: if language english show this
 
Ok - I see what you are trying to do...

I am really guessing here (I might be 100% wrong)... but I am trying to help anyway... so if you like, you could try the following...

In your skins/customer/home.tpl (might be skins1 directory - just check yours) - use the following code...

{if $page_name eq "home" && $main eq 'catalog'}
{include file="{$SkinDir}/{$shop_language}/homepage_content.html"}
{/if}

Note: at best this will only work to input a section of html on your homepage (and you will have to specify in the html width=100% etc., so that things do not get messy on different screen sizes)
i.e. you can not use an html page, to replace your homepage and expect anything to function as anything but an html page (so this, if it works, will only place the html content into the area specified).

Then set up a few directories on your server, under "skins" (or is it called "skins1" directory - check as I said) for each language you have, add a new "language" directory.
e.g. skins/US, skins/JP etc. and put the "homepage_content.html" page for each language, into the language code directory / folders...

Please note that I am really unsure if this will actually work (as I am a million miles away from being a programmer - lol)... but try if you like... ;)

Perhaps others have a better idea... :)

Cheers - Asiaplay

PS: I am unsure if you can "include" an html file... you might have to include a "tpl" file for this to work at all...

Asiaplay 01-30-2009 01:15 AM

Re: if language english show this
 
It seems that including a php file is possible (and php as you know, can include html within it no problem).
Based on this post - see http://forum.x-cart.com/showthread.php?t=43708&page=2

So perhaps the following is better approach...

{if $page_name eq "home" && $main eq 'catalog'}
{include_php file="{$SkinDir}/{$shop_language}/homepage_content.php"}
{/if}

Hope helps a little - cheers, Asiaplay


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

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