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

if language english show this

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 01-29-2009, 09:33 AM
 
Oktane Design Oktane Design is offline
 

Member
  
Join Date: Apr 2008
Posts: 29
 

Default 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
__________________
X-Cart version 4.2
Reply With Quote
  #2  
Old 01-29-2009, 11:57 AM
 
Asiaplay Asiaplay is offline
 

X-Wizard
  
Join Date: Oct 2005
Posts: 1,242
 

Default 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
__________________
X-Cart Gold version 4.1.9
(plus built in X-Cart bugs!)
Reply With Quote
  #3  
Old 01-29-2009, 12:01 PM
 
Oktane Design Oktane Design is offline
 

Member
  
Join Date: Apr 2008
Posts: 29
 

Default 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
__________________
X-Cart version 4.2
Reply With Quote
  #4  
Old 01-29-2009, 01:04 PM
 
Asiaplay Asiaplay is offline
 

X-Wizard
  
Join Date: Oct 2005
Posts: 1,242
 

Default 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...
__________________
X-Cart Gold version 4.1.9
(plus built in X-Cart bugs!)
Reply With Quote
  #5  
Old 01-30-2009, 01:15 AM
 
Asiaplay Asiaplay is offline
 

X-Wizard
  
Join Date: Oct 2005
Posts: 1,242
 

Default 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
__________________
X-Cart Gold version 4.1.9
(plus built in X-Cart bugs!)
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:44 PM.

   

 
X-Cart forums © 2001-2020