hi
i want to use the language files in my cmsms
the usage
$this->Lang("LINK_TO_HOMEPAGE")
if i want to appear in my template
than i must use
$this->smarty->assign("LINK_TO_HOMEPAGE",$this->Lang("LINK_TO_HOMEPAGE"));
and in the template use
{$LINK_TO_HOMEPAGE}
is there another possibility?
because i have 100 lang[] array elements
and i dont want to write 100 assign row
is there another possibility to assign all?
or to not use assign
to include directly into the template?
thanks
languages into templates? [solved]
languages into templates? [solved]
Last edited by pumuklee on Mon Jun 11, 2007 1:11 pm, edited 1 time in total.
Re: languages into templates?
If you have a possibility, load full array and assign it:pumuklee wrote: i want to use the language files in my cmsms
the usage
$this->Lang("LINK_TO_HOMEPAGE")
if i want to appear in my template
than i must use
$this->smarty->assign("LINK_TO_HOMEPAGE",$this->Lang("LINK_TO_HOMEPAGE"));
and in the template use
{$LINK_TO_HOMEPAGE}
is there another possibility?
because i have 100 lang[] array elements
and i dont want to write 100 assign row
is there another possibility to assign all?
or to not use assign
to include directly into the template?
$this->smarty->assign_by_ref("LANG_ARRAY",$arr_lang);
and in template:
{$LANG_ARRAY.key}
This output value of $arr_lang['key']
or UDT: mylang
Code: Select all
$arr_lang = array(
'key1'=>'val1',
'key2'=>'val2',
'key3'=>'va3',
);
if (isset($params[key])) echo $arr_lang[$params[key]];
echo ''
{mylang key=key2}
Alby
Last edited by alby on Mon Jun 11, 2007 10:43 am, edited 1 time in total.
Re: languages into templates?
yes you have right
but i want ot use this Lang() function
because it is working for many language file
my question is that i can be assign more variables
im not sure because i dont find a proper documnetation for this
the function can be called with some parameters
but is didnt find what kind of these
thanks
but i want ot use this Lang() function
because it is working for many language file
my question is that i can be assign more variables
im not sure because i dont find a proper documnetation for this
the function can be called with some parameters
but is didnt find what kind of these
thanks
Re: languages into templates?
ok
i see that this $params is used for vsprintf for string for
about the function Lang() i see that it can be load just one define from $lang array
any idea how can i load more or all varables at one time
because to write az assign line for every 100 variable it is a little bit complicated
thanks
i see that this $params is used for vsprintf for string for
about the function Lang() i see that it can be load just one define from $lang array
any idea how can i load more or all varables at one time
because to write az assign line for every 100 variable it is a little bit complicated
thanks
Re: languages into templates?
Why not include file lang of your interest?pumuklee wrote: i see that this $params is used for vsprintf for string for
about the function Lang() i see that it can be load just one define from $lang array
any idea how can i load more or all varables at one time
because to write az assign line for every 100 variable it is a little bit complicated
Alby
Re: languages into templates?
i found a solution
in mymodule.module.php
i created a new function
function lang_var_list($varlist_array)
{
for($i=0;$ismarty->assign($varlist_array[$i],$this->Lang($varlist_array[$i]));
}
}
aftre that in the page where i want to assign more variables
i used in this way
$varlist_array = array('ADMIN_NEW_ORDERS','ADMIN_SETTINGS_GENERAL','ADMIN_SHIPPING_PAGE');
$this->lang_var_list($varlist_array);
in this way i dont need to write an assign row for every variable
thanks for the helps
any other idea?
in mymodule.module.php
i created a new function
function lang_var_list($varlist_array)
{
for($i=0;$ismarty->assign($varlist_array[$i],$this->Lang($varlist_array[$i]));
}
}
aftre that in the page where i want to assign more variables
i used in this way
$varlist_array = array('ADMIN_NEW_ORDERS','ADMIN_SETTINGS_GENERAL','ADMIN_SHIPPING_PAGE');
$this->lang_var_list($varlist_array);
in this way i dont need to write an assign row for every variable
thanks for the helps
any other idea?