Is there any other easier way to convert smarty array to javascript? I use: This outputs all array items to page source...
Which is normal: all javascript code is outputted to the browser. you can't assign the value of an array element by using php without displaying it in the source code. I think that's the easiest way to accomplish what you want
I think what you have is the best you can get out of Smarty unless you want to create your own Smarty function to output an array as JSON and then have JavaScript parse it (probably wouldn't be too hard to do). Here's some resources: http://smarty.php.net/manual/en/api.register.function.php http://www.json.org/js.html