Yii::app()->clientScript->registerCoreScript('jquery'); gives error in

Trying to include jquery, I added the following line to index.php at the bottom.

Yii::app()->clientScript->registerCoreScript('jquery');

<?php





// change the following paths if necessary


$yii='e:xampphtdocsyiiframeworkyii.php';


$config=dirname(__FILE__).'/protected/config/main.php';





// remove the following line when in production mode


defined('YII_DEBUG') or define('YII_DEBUG',true);





require_once($yii);


Yii::createWebApplication($config)->run();


Yii::app()->clientScript->registerCoreScript('jquery');


?>

This however results in an error at the end of the page.



Fatal error: Call to a member function recordCachingAction() on a non-object in E:xampphtdocsyiiframeworkwebCClientScript.php on line 279


Anyone got an idea what may be causing it? The jquery library seems to load just fine as tested with



 		$(document).ready(function(){


 			$("a").click(function(event){


   			event.preventDefault();


   			$(this).hide("slow");


 			});


 		});


and urls fade out just fine.

This is because you are calling this outside of the application lifecycle.

The method requires the existence of a current controller instance.

Ah, but where do I include it then properly if I want it to be part of the whole site?

Put it in your layout view file.

I want to write an extension extends a CLogRoute class, but in render I need to use jQuery functions.

How I can register jquery script inside an extension?