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

Using Variable for $lng in Template

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-15-2009, 07:59 AM
  MattAustin's Avatar 
MattAustin MattAustin is offline
 

Advanced Member
  
Join Date: Jul 2008
Posts: 41
 

Default Using Variable for $lng in Template

Hello,
I want to pass a value from PHP to a template to reference a $Lng variable like:

$var = 'eml_some_lang_text'

in template to display something like

{$lng.$var} I know this is incorrect but does anyone know how I might achieve this?
Thanks
__________________
xcart version 4.1.6 Gold
Linux 2.6.9-67.0.20.ELsmp
www.qvsdirect.com
Reply With Quote
  #2  
Old 10-22-2009, 03:54 AM
  MattAustin's Avatar 
MattAustin MattAustin is offline
 

Advanced Member
  
Join Date: Jul 2008
Posts: 41
 

Default Re: Using Variable for $lng in Template

Bump
__________________
xcart version 4.1.6 Gold
Linux 2.6.9-67.0.20.ELsmp
www.qvsdirect.com
Reply With Quote
  #3  
Old 10-22-2009, 09:53 AM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

Default Re: Using Variable for $lng in Template

Would you like to define a text label in your language (Administration area) then use this label in your templates?
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
Reply With Quote
  #4  
Old 10-22-2009, 10:09 AM
 
geckoday geckoday is offline
 

X-Wizard
  
Join Date: Aug 2005
Posts: 1,073
 

Default Re: Using Variable for $lng in Template

I'm a little surprised that your approach doesn't work given the cleanup of language substitution in 4.1.x. Double check that eml_some_lang_text is defined in the language the store is set to.

An alternative to your approach is to get the language variable in the PHP code and pass the text to the template:

$langtext = func_get_langvar_by_name("eml_some_lang_text")
__________________
Manuka Bay Company
X-Cart Version 4.0.19 [Linux]

UGG Boots and other fine sheepskin products
http://www.snowriver.com
Reply With Quote

The following user thanks geckoday for this useful post:
MattAustin (10-26-2009)
  #5  
Old 10-26-2009, 06:19 AM
  MattAustin's Avatar 
MattAustin MattAustin is offline
 

Advanced Member
  
Join Date: Jul 2008
Posts: 41
 

Default Re: Using Variable for $lng in Template

That actually makes the most sense.
Thanks
__________________
xcart version 4.1.6 Gold
Linux 2.6.9-67.0.20.ELsmp
www.qvsdirect.com
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:55 PM.

   

 
X-Cart forums © 2001-2020