日期:2014-05-17 浏览次数:20680 次
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . "/js/TableView.js"); Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . "/js/datechooser.js"); Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . "/css/datechooser.css");
Yii::app()->clientScript->registerCoreScript('jquery');
public function init() { //parent::init(); Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl.'/css/my.css'); Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/css/my.js'); }
<!-- css --> <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/print.css" media="print" /> <!-- 图片 --> <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/js/autocomplete/indicator.gif" /> <!-- js --> <script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.js"></script>
<?php <!-- (一)简单用法 --> <!-- js --> Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . "/js/jqueryui/jquery-ui.min.js", CClientScript::POS_END); <!-- (二)复杂用法 --> if($this->user->id) { Yii::app()->clientScript->registerScriptFile(Yii::app()->createUrl('/account/info', array('format' => 'js')), CClientScript::POS_END); } if($this->user->id) { Yii::app()->clientScript->registerScriptFile(Yii::app()->createUrl('site/baseJs')); } ?>