Tips & Tricks

Javascript code in PHP file without the <script> tag

  - 1 min read
Javascript code in PHP file without the <script> tag

 Working with Zend Framework 2 using PhpStorm IDE, when using viewhelpers like inlineScript the syntax highlighting don't work properly: 

 The solution: use HEREDOC

 To get PhpStorm code injection to work use HEREDOC to wrap the JavaScript code. 

 Now not only the syntax highlighting works fine, but in PhpStorm you can use "Edit JavaScript Fragment" to edit the JavaScript code and use code completion and other PhpStorm tools. 

   

Copyright © - 2013 ismaail.com. All rights reserved.