Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-05-2008, 07:34 PM
k2s k2s is offline
Junior Member
 
Join Date: Jul 2008
Posts: 1
Default headScript()->captureStart() helper and syntax highlighting in editor

There are functions captureStart() and captureEnd() in Zend_View_Helper_HeadScript. This functions add script tag to the captured text.

This means that I am not allowed to user <script> tag in my view source file. So my editor is not recognizing that it is and JavaScript code, thinks it is HTML and does not apply syntax highlighting.

I would like to write code:
Code:
<?php $this->headScript()->captureStart() ?>
<script>
dojox.off.ui.appName = "Example Application";
....
<?php $this->headScript()->captureEnd() ?>
</script>
But unfortunately it will be changed to:
Code:
<script type="text/javascript">
//<![CDATA[
<script>
dojox.off.ui.appName = "Example Application";
....
</script>
//]]>

</script>
Is there a work around ?
Would it not be possible to add parameter to captureStart which would delete first and last line of captured text on request ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-13-2008, 10:27 AM
Junior Member
 
Join Date: Aug 2008
Location: Frankfurt/Germany
Posts: 3
Lightbulb

Two possible solutions:
  1. Keep JavaScript code in separate files. Clean way in general but not suitable for very short scripts.
  2. Hack the editor! Maybe there's a simple way to change the script detection of the highlighter.

Of course you may alter the headScript helper but it works in a correct way and this is in fact an editor issue.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-14-2008, 12:22 AM
Member
 
Join Date: Jul 2008
Posts: 46
Default

Another possible solution is not to use the headScript() helper, but just a standard placeholder (or your own extension of). Then you would be responsible for everything it outputs.
__________________
Brenton Alker
Brisbane, Australia

http://blog.tekerson.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:57 PM.