Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not Solved [JavaScript] how can i use condition in themplate by javascript ?
#1
Not Solved
why this code is not correct?

<script type="text/javascript">
 document.write({$multipage});
 </script>

output is :
);

what is the correct format ?
#2
Not Solved
<script type="text/javascript">
document.write('{$multipage}');
</script>

Does that work?
No longer involved in the MyBB project.
#3
Not Solved
no it doesnt work.

(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.
#4
Not Solved
Can you post an extract of the HTML output?
No longer involved in the MyBB project.
#5
Not Solved
the output is :

[Image: 41298226262666887842.png]

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.
#6
Not Solved
You're not escaping the string. You need to put a backslash before each single quote.
No longer involved in the MyBB project.
#7
Not Solved
in header template :
[Image: p91_Untitled44.png]

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 :

[Image: w8495_Untitled11.png]

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.
#8
Not Solved
developers plz help me...
#9
Not Solved
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.


Forum Jump:


Users browsing this thread: 1 Guest(s)