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)
-   -   Using Variable for $lng in Template (https://forum.x-cart.com/showthread.php?t=50203)

MattAustin 10-15-2009 07:59 AM

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

MattAustin 10-22-2009 03:54 AM

Re: Using Variable for $lng in Template
 
Bump

ADDISON 10-22-2009 09:53 AM

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?

geckoday 10-22-2009 10:09 AM

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")

MattAustin 10-26-2009 06:19 AM

Re: Using Variable for $lng in Template
 
That actually makes the most sense.
Thanks


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

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