clientScript Issue

I have this piece of code in my layout


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo Yii::app()->locale->getId(); ?>" >

<head>

<?php

Yii::app()->clientScript->registerMetaTag('text/html; charset=utf-8',null,'Content-Type');

Yii::app()->clientScript->registerMetaTag(Yii::app()->locale->getId(),'language');

Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl.'/css/screen.css','screen, projection');

Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl.'/css/print.css','print');

?>

<!--[if lt IE 8]>

<?php echo Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl.'/css/ie.css','screen, projection'); ?>

<![endif]-->

<title><?php echo $this->pageTitle; ?></title>

</head>

however, when it is rendered in the browser i get


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_us" >

<head>

<!--[if lt IE 8]>

<![endif]-->

<meta content="text/html; charset=utf-8" http-equiv="Content-Type" /><meta content="en_us" name="language" /><link rel="stylesheet" type="text/css" href="/yii/site/themes/classic/css/screen.css" media="screen, projection" />

<link rel="stylesheet" type="text/css" href="/yii/site/themes/classic/css/print.css" media="print" />

<link rel="stylesheet" type="text/css" href="/yii/site/themes/classic/css/ie.css" media="screen, projection" />

<title>My Web Application</title>

</head>

The css file that is supposed to target IE browsers that i placed inside


<!--[if lt IE 8]>

<![endif]-->

in the markup is not rendered where i placed it. Why does this happen?

CClientScript::registerCssFile() doesn’t render in place. You should use CHtml::cssFile() here.

I suddenly realized how clientScript should be used a few minutes after posting. Thank you by the way.