CClientScript -> registerScript

I like to use the registerScript function to insert peices of JS code because it lets you specify where in the document to place that code. The one slight drawback of this is that the code needs to be inserted in a string - this means you lose things like syntax highlighting in your editor.

Is it possible to do this any other way?

There is registerScriptFile() for this… :D