I\'m using the Zend Framework\'s javascript helpers of the form:
headScript()->captureStart(); ?>
//Javascript here
h
I was actually just reading about this yesterday in their blog:
Their HTML in PHP parsing has been flaky, especially with indenting incorrectly short/alternate form code, but the latest nightly builds (I presume those after 201010060000) have improvements in that area. I haven't tried it yet but give it a shot.
Something like this:
<?php $this->headScript()->captureStart(); ?>
//<script type="text/javascript">
var validJSsyntax = true,
netbeansJShighlighting = true,
problem = 'solved';
//</script>
<?php $this->headScript()->captureEnd(); ?>
Of course it will produce two useless lines in your JS output, but you can modify captureEnd()
method to strip those for you.
print problematic code with PHP
<script <?PHP echo 'type="text/template"?> id="Template-1">
//your code here
</script>
If you print all script tag with PHP, NetBeans perfectlly format HTML tags
From my knowledge this functionality is not yet implemented in the current version of NetBeans IDE that is 6.9.1. I can show you a workaround through which you can fool the NetBeans IDE to highlight the Javascript as a script section, and also keeps the PHP processor happy. It will look like following code snippet:
<?php $this->headScript()->captureStart(); ?>
<?php if( false ) {?><script><?php } ?>
// keep Javascript here
<?php if( false ) { ?></script><?php } ?>
<?php $this->headScript()->captureEnd(); ?>
I have tested this in NetBeans IDE 6.9.1