Problem with registerCoreScript

Hello everybody

I am starting with Yii, and I am having a very frustating experience when I try to use jquery.

Basically when I use the following code Yii:app()->clientScript->registerCoreScript(‘jquery’); the page stops and no more code or html is showed.

I am playing with the most basic code, basically modifying the helloWord to add a jquery effect:






<h1 class=“test”><?php echo $this->id . ‘/’ . $this->action->id; ?></h1>

<p>You may change the content of this page by modifying the file <tt><?php echo FILE; ?></tt>.</p>




'&#036;(&quot;.test&quot;).animate({opacity: 1.0},5000).fadeOut(&quot;slow&quot;);');


I have tried to call registerCoreScript in other files, layout/main.php but the same result, the page stops.

I would appreciate any kind of help

Thanks in advance

Best Regards


If you need to load the script, do it in your controller, before the page is rendered, because Yii needs to put that script in a certain position of your layout/view.

If you call it after the page starts processing, then it have no use.

Also, there is no need to call registerCoreScript();

You can do something like that in the controller:

$fancyJquery = ‘my animation code here’;


in this case, the jquery.js file will be inserted automatically by Yii .

Thanks, but it is not working.

I have tried the same code in the controller class, but nothing when this code line is executed the process stops. It can be some kind of abnormal termination in php.



Hi there Rafa,

It is very weird as you say as that should’t be a problem at all. I do render my main scripts (CORE) normally in my main layout. In fact, there I register any site-related files and I have no problems at all.

First of all, lets try this:

  1. Do just register your core file (Yii:app()->clientScript->registerCoreScript(‘jquery’); ) and comment the rest of the registrations. We are going to go step by step in your code to find out what really happens and if it is really the registerCoreScript that fails.

  2. Make sure, before testing, that your assets folder (www/assets) is writable.

And we work from there…

Try a different computer with different versions, and everything is working :-S




Nevertheless, it could have been good if we knew what was the actual problem and find its solution for future references.