By default…
Yii::App()->clientScript->registerCoreScript('jquery');
…will include the script tag for the jQuery core script inside the head of your page immediately before your title tag.
There are times when you will want to include it just after the opening body tag and just before the closing body tag.
CClientScript::POS_HEAD will be positioned in the head just before the title tag
CClientScript::POS_BEGIN will be positioned immediately after the opening body tag
CClientScript::POS_END will be position immediately before the closing body tag
You have two ways to specify the location you would like. You can include your choice in the config/main.php file (or your own config file)…
'clientScript'=>array(
'coreScriptPosition' => CClientScript::POS_END,
),
…inside the components array.
Or you can specify it in a controller or view (usually just before you register the core script(s) using…
Yii::app()->clientScript->coreScriptPosition=CClientScript::POS_END;
Remembering to update POS_END with your chosen position.
