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

How to call a language variable

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-12-2011, 04:23 PM
 
frontliner frontliner is offline
 

Advanced Member
  
Join Date: Apr 2011
Location: Mons - Belgium
Posts: 53
 

Default How to call a language variable

Hi there,

I have a text that comes back in a lot of products pages. So, my idea is to insert that text in a language variable.

Problem is how to call the variable from txt_welcome, from category description and from product description ?

I have tested from txt-welcome but the variable itself is interpreted as text...

So, how to call it ?...i've not found in my research in the forums.

Thanks.
__________________
X-Cart Gold v4.4.3
Reply With Quote
  #2  
Old 07-12-2011, 05:45 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,201
 

Default Re: How to call a language variable

{$lng.your_variable}. But you can't have language variable inside language variable
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #3  
Old 07-13-2011, 04:49 AM
 
frontliner frontliner is offline
 

Advanced Member
  
Join Date: Apr 2011
Location: Mons - Belgium
Posts: 53
 

Default Re: How to call a language variable

Steve,

Before creating my own language variable, i tried again to test with an existing one but it doesn't work. I tried to put the following both in category description and in product description but it is still treated as text :

{$lng.disable_chinfo_msg}

{$lng.txt_disable_chinfo_msg}

{literal}
{$lng.txt_disable_chinfo_msg}
{/literal}

{{$lng.txt_disable_chinfo_msg}}

Those 4 attempts above did not displayed the text contained but only the variable itself.

I have a doubt as if the variable could not be found it should maybe give back an error but not display the variable itselfs logically.

I have both french and english languages installed with english currently disabled, the variable is called from the french language version. Is the path to the variable wrong ?
__________________
X-Cart Gold v4.4.3
Reply With Quote
  #4  
Old 07-13-2011, 04:59 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,201
 

Default Re: How to call a language variable

You also cannot have smarty tags inside descriptions (they are treated as plain text) or if you insist of doing it you have to call the decsription with "eval" function in the template so the smarty tags are resolved - http://www.smarty.net/docs/en/language.function.eval.tpl
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #5  
Old 08-24-2011, 01:48 AM
 
makenoiz makenoiz is offline
 

Advanced Member
  
Join Date: Jun 2011
Posts: 35
 

Default Re: How to call a language variable

Technically, should I be able to use {$lng.lbl_myLabel} inside the includes/help.php file. It not working correctly when placed there.
__________________
X-Cart version 4.4.3
Reply With Quote
  #6  
Old 08-24-2011, 01:59 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: How to call a language variable

This is smarty code which cannot be used in PHP script directly.

You should use the following PHP code instead:
PHP Code:
func_get_langvar_by_name("lbl_myLabel"); 
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
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 09:39 PM.

   

 
X-Cart forums © 2001-2020