| [news.eclipse.tools.pdt] Re: PHP inside of Javascript in a .php file |
Couple thoughts...
Thus:
<?php
function SomeFunction()
{?> <script type="text/javascript"> parentValue = '<?php print $parentValue; ?>'; </script> <? }
?>
Or, better:
<?php
function SomeFunction()
{
print<<<EOHTML
<script type="text/javascript">
parentValue = '${parentValue}';
</script>
EOHTML; // must be flushed to left margin
}?>
I have Javascript code that I output inside of a PHP file, but put variables inside the javascript block. I am getting a weird error:
<?php
function SomeFunction() {
?> <script type="text/javascript"> parentValue = <?=$parentValue?>; </script> <? }
?>
I get an error over the '<?' of the '<?=' expresssion in the javascript block saying: Syntax error on tokens, PostfixExpression expected instead
Anyone know why this is?
Thanks, Micah
-- Nick Boldt :: http://wiki.eclipse.org/User:Nickb