2013-09-09, 04:52 PM
2013-09-09, 04:59 PM
<script type="text/javascript">
document.write('{$multipage}');
</script>
Does that work?
2013-09-09, 05:04 PM
no it doesnt work.
how can i write {$mybb_element} in javascript.
(2013-09-09, 04:52 PM)gnostic Wrote: [ -> ]why blow code is not correct?
<script type="text/javascript"> document.write({$multipage}); </script>
output is :
);
what is the correct format ?
how can i write {$mybb_element} in javascript.
2013-09-10, 02:00 PM
Can you post an extract of the HTML output?
2013-09-10, 02:12 PM
the output is :
![[Image: 41298226262666887842.png]](https://camo.mybb.com/a0048c8255a9d2bbf2126044e35500cecf170aba/687474703a2f2f75706c6f6164372e69722f696d616765732f34313239383232363236323636363838373834322e706e67)
this error get because i use {$welcomeblock}\, i dont khow how can show {$welcomeblock} in javascript.
i use php echo command too, but i get above error.
this error get because i use {$welcomeblock}\, i dont khow how can show {$welcomeblock} in javascript.
i use php echo command too, but i get above error.
2013-09-10, 02:21 PM
You're not escaping the string. You need to put a backslash before each single quote.
2013-09-10, 02:37 PM
in header template :
![[Image: p91_Untitled44.png]](https://camo.mybb.com/28e5923644e00b223185e488f0c7a0c6dcc07c7d/687474703a2f2f75706c6f616474616b2e636f6d2f696d616765732f7039315f556e7469746c656434342e706e67)
i want, when my condition is true,{$welcomeblock} apear and else no apear.
but blow code is not correct :
and output of above code is :
![[Image: w8495_Untitled11.png]](https://camo.mybb.com/cd310ffd107c2540e3cbe30ffa0cbdbe4098a7d9/687474703a2f2f75706c6f616474616b2e636f6d2f696d616765732f77383439355f556e7469746c656431312e706e67)
this error get because i use {$welcomeblock}, i dont khow how can show {$welcomeblock} in javascript.
i use php echo command too, but i get above error.
i want, when my condition is true,{$welcomeblock} apear and else no apear.
but blow code is not correct :
<script type="text/javascript">
if (my condition is true)
{
{$welcomeblock}
}
else
{
}
</script>
and output of above code is :
this error get because i use {$welcomeblock}, i dont khow how can show {$welcomeblock} in javascript.
i use php echo command too, but i get above error.
2013-09-11, 04:18 PM
developers plz help me...
2013-09-11, 07:28 PM
I'm not sure you can actually do what you are trying to do there because you are using a variable in PHP within a section of javascript. PHP is parsed server side while Javascript is client side.