Access to registered core scripts

The project I am working on needs to maintain JavaScript state across links - so all in site links work through ajax (in a similar way to how facebook do it, using the hash in the url to store page state)

I’ve almost got everything working, but I am having a problem with core scripts.


When a view uses a CGridView, it registers some core JavaScript. I can’t work out how to get access to these urls so that I can pass the urls back in the AJAX request. They are stored in CClientScript in a private array so I can’t extend to create a getter.

I understand that some properties are private to protect against future framework changes, but this is data that is pushed to the browser; surely it is accessible in some way?

Perhaps I am going about it the wrong way. Anyone have any ideas?

I’ve realised I can work around this by setting the base files to false in my extended controller …

$cs = Yii::app()->getClientScript();




And then copy, rename the file and include it on the relevant pages with.

$cs->registerScriptFile(Yii::app()->baseUrl . '/js/');

Nasty, but it works. I’d prefer a solution that isn’t reinventing the wheel.

I’ll work out google includes later, as that will have to be reworked for this.