|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
krodelabestiole Smarty n00b
Joined: 05 Jul 2011 Posts: 4
|
Posted: Sun Nov 27, 2011 6:54 pm Post subject: config file to javascript (json ?) |
|
|
i was trying to figure out how to pass variables i get in an INI file to javascript (i'm interested in passing a language file here)
i thought of many way to do this but none worked yet (javascript ini parser i.e.).
I think a quite simple way to achive this would be to pass variables thru json using javascript
my config file is dynamicaly load using
Code: | {config_load scope="global" file="lang/`$smarty.session.lang`.txt"} |
(using a session variable)
this works fine
now i've tried codes such as :
Code: | <script type="text/javascript">
lang = {$smarty.config|@json_encode};
</script> |
or
Code: | <script type="text/javascript">
{foreach from=$smarty.config item=data}
{$data}
{/foreach}
</script> |
but i still get this warning :
Quote: | Missing argument 1 for Smarty_Internal_Data::getConfigVariable() |
is there a way to loop on variables i get from a config file for example ?
or do you think of any total different way to do that ?
any help appreciated !
thanks ! |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|