Place specific script files in <HEADER> (not <BODY>)

Do you know how do I place all script files (CSS and JS) in <header> instead of <body>?

AFAIK those files are parsed and passed to the main view as a $content variable. But maybe there is a way to divide it into two variables: one containing content and other containing files?

Yoin ur view or controller, use Yii::app()->getClientScript()->registerScriptFile(file,CClientScript::POS_HEAD) and registerCssFile() for CSS. This will place them in the head.