If you are looking for a talented web frontend programmer I can only speak good words about this bloke.
Why this hack?
Syntax highlighting is essential for developers. If you are familiar with
Zend Framework you will know that InlineScript
view helper doesn’t need the
<script> tag. The reason is simple, that tag is
automatically included at the view rendering stage. There is one big disadvantage
however when you are developing in your favorite IDE… No syntax highlighting for
When I noticed that, I searched for a solution at Google. No luck this time… So
language in source files thanks to the
<script> tag, so that should be a good
start. If we could find a way to keep the tag in the source file and remove it
before rendering it the problem would disappear.
How it works?
inherits from HeadScript
Taking a look at the HeadScript
__call method, the
createData function is the best candidate to solve this
tag issue. If we look at Zend Framework’s source code, the 3rd parameter is the
Once we have this function located is very easy to remove the
<script> tag. We
just need to create a custom view helper extending Zend Framework’s one in order
to override the
createData method. At this point take a look at the source code
below to see how it works.
I hope this post will prove useful to other developers who have been in the same situation as me.
Note: Don’t forget that custom view helpers prefix and paths have to be properly configured in your application to be automatically loaded and used.