JackTheRussel
Programmer
Hi all.
I just started to study smarty and I find out problems right away.
I try to put smarty-value to the javascript variable like this:
page.php
page.tpl
But when I look my_js_variable it is undefined ?
How can I set smarty-value to the js-variable ?
[/code]
I just started to study smarty and I find out problems right away.
I try to put smarty-value to the javascript variable like this:
page.php
Code:
$my_variable="foo";
smarty->assign("somevalue", $my_variable);
smarty->display("page.tpl);
page.tpl
Code:
{literal}
<script language="JavaScript">
var my_js_variable = ({$somevalue});
</script>
{/literal}
But when I look my_js_variable it is undefined ?
How can I set smarty-value to the js-variable ?
[/code]