htmlHelper script breaks syntax highlight

Hii there,

I’ve been trying to get the scriptStart() method to work but there is one little quirck with it.
You see, whenever I use this (of course, along with scriptEnd()), what happens is I need to remove my <script> tags from my template file, which causes syntax highlighting to break.
So my question is, is there any way to get around this without fiddling around with the IDE?

scriptStart and scriptEnd wrap the contents in a script tag. If you don’t want that, is there anything else that those functions add that you do need?

There are a few scripts that I want to use this on (so it’ll always be slam dunked in the same area of the page instead of slab-dab in the middle of it).
One of those scripts basically sends an AJAX-request to an API to get the changelog for a certain project.
I could in theory add this to one global JavaScript file but this would make a huge mess in the long run (and adds additional JavaScript for something people might never even use)…

I think it would be nice to have a way to disable the wrapping in a script tag…

My point is that those functions build an block of output, and then at the end wrap the contents of that block in script tags. You seem to want the block of output rendered as-is, without the script tags. Is that the entirety of it? If so, then the only thing of value to you that the functions are providing is building a block of output, and there are other functions that do that just as well, without the part you don’t want.

well, the thing is this:
If I use the scriptStart and scriptEnd methods, I break the syntax highlighting in my editor, which makes writing code more difficult (in case I need to update something for example).
Instead of this:

I’ll be looking at this:

That doesn’t work very nicely at all but it’s either having my scripts all over the place or not being able to read my code without additional steps.

This solves one issue but now it breaks the code itself (obviously, since CakePHP also adds the script tags)

You’re still missing my point, I think. What’s wrong with:

<?php $this->start('pageScript'); ?>
<script>
    $(document)....
</script>
<?php $this->end(); ?>

I didn’t know of the existence of those (only the scriptStart and scriptEnd)…
They seem to do what I want :slight_smile: