本文整理汇总了PHP中CHtml::cssFile方法的典型用法代码示例。如果您正苦于以下问题:PHP CHtml::cssFile方法的具体用法?PHP CHtml::cssFile怎么用?PHP CHtml::cssFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHtml
的用法示例。
在下文中一共展示了CHtml::cssFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerCssAndScriptsFiles
/**
* Register using yii methode the css and javascript files.
* The helper will choose the way to register the file depending on :
* 1. It's an ajax request or not
* 2. It's a css or a javascript file
* @param array $files an array with the file path of the css and js to register.
* The paths must be relative from the baseUrl. Ex : '/assets/plugins/bootstrap-datepicker/css/datepicker.css'
* @return true if everything done right
*/
public static function registerCssAndScriptsFiles($files, $path = null)
{
$cs = Yii::app()->getClientScript();
if (!$path) {
$path = Yii::app()->theme->baseUrl;
}
$ajaxRequest = Yii::app()->request->isAjaxRequest;
foreach ($files as $file) {
$extention = pathinfo($file, PATHINFO_EXTENSION);
if ($extention == "js" || $extention == "JS") {
if ($ajaxRequest) {
echo CHtml::scriptFile($path . $file);
} else {
$cs->registerScriptFile($path . $file, CClientScript::POS_END, array(), 2);
}
} else {
if ($extention == "css" || $extention == "CSS") {
if ($ajaxRequest) {
echo CHtml::cssFile($path . $file);
} else {
$cs->registerCssFile($path . $file);
}
} else {
//unknown extension
throw new InvalidArgumentException("unkonw file extension : " . $extention);
}
}
}
return true;
}
示例2: init
public function init()
{
foreach (self::getCssFiles(YII_DEBUG) as $file) {
if (isset($file[2])) {
echo '<!--[if lt IE ' . $file[2] . ']>' . "\n";
}
echo CHtml::cssFile($file[0], isset($file[1]) ? $file[1] : '') . "\n";
if (isset($file[2])) {
echo '<![endif]-->' . "\n";
}
}
}
示例3: renderHead
/**
* Combine css files and script files before renderHead.
* @param string the output to be inserted with scripts.
*/
public function renderHead(&$output)
{
if ($this->combineCssFiles) {
$this->combineCssFiles();
}
if ($this->combineScriptFiles && $this->enableJavaScript) {
$this->combineScriptFiles(self::POS_HEAD);
}
$html = '';
foreach ($this->metaTags as $meta) {
$html .= CHtml::metaTag($meta['content'], null, null, $meta) . "\n";
}
foreach ($this->linkTags as $link) {
$html .= CHtml::linkTag(null, null, null, null, $link) . "\n";
}
foreach ($this->cssFiles as $url => $media) {
$html .= CHtml::cssFile($url, $media) . "\n";
}
foreach ($this->css as $css) {
$html .= CHtml::css($css[0], $css[1]) . "\n";
}
if ($this->enableJavaScript) {
if (isset($this->scriptFiles[self::POS_HEAD])) {
foreach ($this->scriptFiles[self::POS_HEAD] as $scriptFileValueUrl => $scriptFileValue) {
if (is_array($scriptFileValue)) {
$html .= CiiHtml::scriptFile($scriptFileValueUrl, $scriptFileValue) . "\n";
} else {
$html .= CiiHtml::scriptFile($scriptFileValueUrl) . "\n";
}
}
}
if (isset($this->scripts[self::POS_HEAD])) {
$html .= $this->renderScriptBatch($this->scripts[self::POS_HEAD]);
}
}
if ($html !== '') {
$count = 0;
$output = preg_replace('/(<title\\b[^>]*>|<\\/head\\s*>)/is', '<###head###>$1', $output, 1, $count);
if ($count) {
$output = str_replace('<###head###>', $html, $output);
} else {
$output = $html . $output;
}
}
}
示例4:
// set language
//
$this->renderPartial('//Config/SetLanguage');
?>
<html>
<head>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<meta charset="utf-8" />
<?php
// css
echo CHtml::cssFile('css/bootstrap.css');
echo CHtml::cssFile('css/ui-lightness/jquery-ui-1.10.3.custom.css');
// js
Yii::app()->clientScript->registerScriptFile('js/jquery-2.0.3.js');
Yii::app()->clientScript->registerScriptFile('js/jquery-ui-1.10.3.custom.js');
Yii::app()->clientScript->registerScriptFile('js/bootstrap.js');
Yii::app()->clientScript->registerScriptFile('js/numeral/numeral.js');
?>
<style>
label {
display: inline-block;
width: 150px;
text-align: right;
}
.form-control {
display: inline-block;
示例5: registerClientScript
/**
* Register the fancybox js-lib
*/
public function registerClientScript()
{
$assets = $this->getAssets();
$cs = Yii::app()->getClientScript();
if ($this->directOutput) {
//no multiple directout if more widgets in a view
if (!self::$_directOutRendered) {
//need to output jquery lib too
//maybe jquery is included twice from other widgets ... but it works !!??
//cannot unregister corescripts ...
$jqueryUrl = $cs->getCoreScriptUrl() . '/jquery.min.js';
echo CHtml::scriptFile($jqueryUrl);
echo CHtml::cssFile($assets . '/jquery.fancybox-1.3.4.css');
echo CHtml::scriptFile($assets . '/jquery.fancybox-1.3.4.pack.js');
if ($this->easing) {
echo CHtml::scriptFile($assets . '/jquery.easing-1.3.pack.js');
}
if ($this->mouseWheel) {
echo CHtml::scriptFile($assets . '/jquery.mousewheel-3.0.4.pack.js');
}
self::$_directOutRendered = true;
}
} else {
$cs->registerCoreScript('jquery');
$cs->registerCssFile($assets . '/jquery.fancybox-1.3.4.css');
$cs->registerScriptFile($assets . '/jquery.fancybox-1.3.4.pack.js');
if ($this->easing) {
$cs->registerScriptFile($assets . '/jquery.easing-1.3.pack.js');
}
if ($this->mouseWheel) {
$cs->registerScriptFile($assets . '/jquery.mousewheel-3.0.4.pack.js');
}
}
}
示例6: setTimeout
<head>
<?php
echo CHtml::metaTag('text/html; charset=utf-8', null, 'Content-Type') . "\n";
echo CHtml::metaTag($delay . '; url=' . CHtml::normalizeUrl($url), null, 'refresh');
?>
<title><?php
echo $this->pageTitle;
?>
</title>
<?php
echo CHtml::cssFile(Helper::mediaUrl('resources/screen.css'), 'screen, projection');
echo CHtml::cssFile(Helper::mediaUrl('resources/print.css'), 'print');
?>
<!--[if lt IE 8]>
<?php
echo CHtml::cssFile(Helper::mediaUrl('resources/ie.css'), 'screen, projection');
?>
<![endif]-->
<style type="text/css">
#redirectMessage {
margin: 18px 0;
text-align: center;
font-size: 1.4em;
font-family: "微软雅黑";
}
</style>
<script type="text/javascript">
//<![CDATA[
if ( navigator.product == 'Gecko' )
setTimeout("moz_redirect()",<?php
echo $delay * 1000 - 500;
示例7: renderHead
/**
* Inserts the scripts in the head section.
* @param string $output the output to be inserted with scripts.
*/
public function renderHead(&$output)
{
$html='';
foreach($this->metaTags as $meta)
$html.=CHtml::metaTag($meta['content'],null,null,$meta)."\n";
foreach($this->linkTags as $link)
$html.=CHtml::linkTag(null,null,null,null,$link)."\n";
foreach($this->cssFiles as $url=>$media)
$html.=CHtml::cssFile($url,$media)."\n";
foreach($this->css as $css)
$html.=CHtml::css($css[0],$css[1])."\n";
if($this->enableJavaScript)
{
if(isset($this->scriptFiles[self::POS_HEAD]))
{
foreach($this->scriptFiles[self::POS_HEAD] as $scriptFile)
$html.=CHtml::scriptFile($scriptFile)."\n";
}
if(isset($this->scripts[self::POS_HEAD]))
$html.=CHtml::script(implode("\n",$this->scripts[self::POS_HEAD]))."\n";
}
if($html!=='')
{
$count=0;
$output=preg_replace('/(<title\b[^>]*>|<\\/head\s*>)/is','<###head###>$1',$output,1,$count);
if($count)
$output=str_replace('<###head###>',$html,$output);
else
$output=$html.$output;
}
}
示例8: renderHead
/**
* Inserts the scripts in the head section.
* @param string $output the output to be inserted with scripts.
* This method is Copyright (c) 2008-2014 by Yii Software LLC
* http://www.yiiframework.com/license/
*/
public function renderHead(&$output)
{
parent::renderHead($output);
$html = '';
foreach ($this->metaTags as $meta) {
$html .= CHtml::metaTag($meta['content'], null, null, $meta) . "\n";
}
foreach ($this->linkTags as $link) {
$html .= CHtml::linkTag(null, null, null, null, $link) . "\n";
}
/* x2modstart */
if (Auxlib::getIEVer() < 10) {
// group registered css files using import statements
$mergedCss = '';
$mediaType = null;
foreach ($this->cssFiles as $url => $media) {
if ($mediaType === null) {
$mediaType = $media;
}
$text = '@import url("' . $url . '");';
if ($media !== $mediaType) {
$html .= CHtml::css($mergedCss, $mediaType) . "\n";
$mergedCss = '';
$mediaType = $media;
}
$mergedCss .= "\n" . $text;
}
if ($mergedCss) {
$html .= CHtml::css($mergedCss, $mediaType) . "\n";
}
} else {
foreach ($this->cssFiles as $url => $media) {
$html .= CHtml::cssFile($url, $media) . "\n";
}
}
if (Auxlib::getIEVer() < 10) {
// merge inline css
$mergedCss = '';
$mediaType = null;
foreach ($this->css as $css) {
$text = $css[0];
$media = $css[1];
if (is_array($text) && isset($text['text'])) {
$text = $text['text'];
}
if ($mediaType === null) {
$mediaType = $media;
}
if (preg_match('/@import/', $text)) {
if ($mergedCss) {
$html .= CHtml::css($mergedCss, $mediaType) . "\n";
}
$mergedCss = '';
$mediaType = null;
$html .= CHtml::css($text, $media) . "\n";
continue;
}
if ($media !== $mediaType) {
$html .= CHtml::css($mergedCss, $mediaType) . "\n";
$mergedCss = '';
$mediaType = $media;
}
$mergedCss .= "\n" . $text;
}
if ($mergedCss) {
$html .= CHtml::css($mergedCss, $mediaType) . "\n";
}
} else {
foreach ($this->css as $css) {
$text = $css[0];
$media = $css[1];
if (is_array($text) && isset($text['text']) && isset($text['htmlOptions'])) {
// special case for css registered with html options
$html .= X2Html::css($text['text'], $media, $text['htmlOptions']);
continue;
}
$html .= CHtml::css($text, $media) . "\n";
}
}
// prevent global css from being applied if this is an admin or guest request
if (!Yii::app()->controller instanceof AdminController && !Yii::app()->user->isGuest) {
$globalCssUrl = GlobalCSSFormModel::getGlobalCssUrl();
$html .= CHtml::cssFile($globalCssUrl . $this->getCacheBusterSuffix($globalCssUrl)) . "\n";
}
/* x2modend */
if ($this->enableJavaScript) {
if (isset($this->scriptFiles[self::POS_HEAD])) {
foreach ($this->scriptFiles[self::POS_HEAD] as $scriptFileValueUrl => $scriptFileValue) {
if (is_array($scriptFileValue)) {
$html .= CHtml::scriptFile($scriptFileValueUrl, $scriptFileValue) . "\n";
} else {
$html .= CHtml::scriptFile($scriptFileValueUrl) . "\n";
}
}
//.........这里部分代码省略.........
示例9:
<!doctype html>
<!--[if IE 7 ]> <html class="no-js ie ie7 lte7 lte8 lte9" lang="en-US"> <![endif]-->
<!--[if IE 8 ]> <html class="no-js ie ie8 lte8 lte9" lang="en-US"> <![endif]-->
<!--[if IE 9 ]> <html class="no-js ie ie9 lte9>" lang="en-US"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="yet another anonymous mining pool for bitcoin and altcoin with auto profit switch and auto exchange">
<meta name="keywords" content="anonymous,mining,pool,maxcoin,bitcoin,altcoin,auto,switch,exchange,profit">
<title>yaamp.com</title>
<?php
echo CHtml::cssFile("/extensions/jquery/themes/ui-lightness/jquery-ui.css");
echo CHtml::cssFile('/yaamp/ui/css/main.css');
echo CHtml::cssFile('/yaamp/ui/css/table.css');
//echo CHtml::scriptFile('/yaamp/ui/js/jquery.tablesorter.js');
echo CHtml::scriptFile('/extensions/jquery/js/jquery-1.8.3-dev.js');
echo CHtml::scriptFile('/extensions/jquery/js/jquery-ui-1.9.1.custom.min.js');
echo "</head>";
示例10: renderHead
/**
* Inserts the scripts in the head section.
* @param string $output the output to be inserted with scripts.
* This method is Copyright (c) 2008-2014 by Yii Software LLC
* http://www.yiiframework.com/license/
*/
public function renderHead(&$output)
{
parent::renderHead($output);
$html = '';
foreach ($this->metaTags as $meta) {
$html .= CHtml::metaTag($meta['content'], null, null, $meta) . "\n";
}
foreach ($this->linkTags as $link) {
$html .= CHtml::linkTag(null, null, null, null, $link) . "\n";
}
foreach ($this->cssFiles as $url => $media) {
$html .= CHtml::cssFile($url, $media) . "\n";
}
/* x2modstart */
if (Auxlib::getIEVer() < 10) {
// merge inline css
$mergedCss = array();
$mediaType = null;
foreach ($this->css as $css) {
$text = $css[0];
if (is_array($text) && isset($text['text'])) {
$text = $text['text'];
}
if (preg_match('/@import/', $text)) {
$html .= CHtml::css($text, $css[1]) . "\n";
continue;
}
if ($mediaType === null) {
$mediaType = $css[1];
}
if ($css[1] === $mediaType) {
if (!isset($mergedCss[$mediaType])) {
$mergedCss[$mediaType] = '';
}
$mergedCss[$mediaType] .= "\n" . $text;
}
}
foreach ($mergedCss as $type => $css) {
$html .= CHtml::css($css, $type) . "\n";
}
} else {
foreach ($this->css as $css) {
$text = $css[0];
$media = $css[1];
if (is_array($text) && isset($text['text']) && isset($text['htmlOptions'])) {
// special case for css registered with html options
$html .= X2Html::css($text['text'], $media, $text['htmlOptions']);
continue;
}
$html .= CHtml::css($text, $media) . "\n";
}
}
/* x2modend */
if ($this->enableJavaScript) {
if (isset($this->scriptFiles[self::POS_HEAD])) {
foreach ($this->scriptFiles[self::POS_HEAD] as $scriptFileValueUrl => $scriptFileValue) {
if (is_array($scriptFileValue)) {
$html .= CHtml::scriptFile($scriptFileValueUrl, $scriptFileValue) . "\n";
} else {
$html .= CHtml::scriptFile($scriptFileValueUrl) . "\n";
}
}
}
if (isset($this->scripts[self::POS_HEAD])) {
$html .= $this->renderScriptBatch($this->scripts[self::POS_HEAD]);
}
}
if ($html !== '') {
$count = 0;
$output = preg_replace('/(<title\\b[^>]*>|<\\/head\\s*>)/is', '<###head###>$1', $output, 1, $count);
if ($count) {
$output = str_replace('<###head###>', $html, $output);
} else {
$output = $html . $output;
}
}
}
示例11:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<?php
echo CHtml::cssFile(Yii::app()->baseUrl . '/css/reset.css');
echo CHtml::cssFile(Yii::app()->baseUrl . '/css/text.css');
echo CHtml::cssFile(Yii::app()->baseUrl . '/css/960.css');
echo CHtml::cssFile(Yii::app()->baseUrl . '/css/dashboard.css');
?>
<title><?php
echo $this->pageTitle;
?>
</title>
</head>
<body>
<div id="page" class="container_12">
<div id="header" class="grid_12">
<div id="logo">Панель управления</div>
</div><!-- header -->
<div id="sidebar" class="grid_4">
<?php
$this->widget('application.components.dashboardMenu');
?>
</div><!-- sidebar -->
<div class="grid_8">
示例12:
// $this->renderPartial('//Config/SetLanguage');
?>
<html>
<head>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<meta charset="utf-8" />
<?php
// css
echo CHtml::cssFile('css/bootstrap.css');
echo CHtml::cssFile('css/ui-lightness/jquery-ui-1.10.3.custom.css');
echo CHtml::cssFile('css/styles.css');
echo CHtml::cssFile('css/bootflat.min.css');
// js
// Yii::app()->clientScript->registerScriptFile('js/jquery-2.0.3.js');
Yii::app()->clientScript->registerScriptFile('js/jquery-ui-1.10.3.custom.js');
Yii::app()->clientScript->registerScriptFile('js/bootstrap.js');
Yii::app()->clientScript->registerScriptFile('js/numeral/numeral.js');
Yii::app()->clientScript->registerScriptFile('js/functions.js');
?>
<title>jPOS <?php
echo Yii::t('lang', 'retail_management_system_sends_all_its_forms');
?>
</title>
</head>
示例13:
<!-- CSS's -->
<?php
$controller = Yii::app()->getController();
$default_controller = Yii::app()->defaultController;
$isHome = $controller->id === $default_controller && ($controller->action->id === $controller->defaultAction || $controller->action->id === 'deslogarUsuario') ? true : false;
echo CHtml::cssFile(Yii::app()->baseUrl . "/assets/bootstrap/css/bootstrap.min.css");
echo CHtml::cssFile(Yii::app()->baseUrl . "/assets/bootstrap-social/bootstrap-social.css");
echo CHtml::cssFile(Yii::app()->baseUrl . "/assets/flex-slider/flexslider.css");
echo CHtml::cssFile(Yii::app()->baseUrl . "/assets/css/css.php");
echo CHtml::cssFile(Yii::app()->baseUrl . "/assets/css/menu/menu1.css");
echo CHtml::cssFile(Yii::app()->baseUrl . "/assets/css/aberturas/cssAberturaSite.css");
if ($isHome) {
echo CHtml::cssFile(Yii::app()->baseUrl . "/assets/css/aberturas/slides.css");
} else {
echo CHtml::cssFile(Yii::app()->baseUrl . "/assets/css/slides.css");
}
?>
<link href='https://fonts.googleapis.com/css?family=Comfortaa:400,700,300' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Droid+Serif:400,700' rel='stylesheet' type='text/css'>
<!-- SCRIPT's -->
<!-- JQuery -->
<?php
echo CHtml::scriptFile(Yii::app()->baseUrl . "/assets/jquery/jquery.min.js");
?>
<!-- Bootstrap core javascript -->
<?php
echo CHtml::scriptFile(Yii::app()->baseUrl . "/assets/bootstrap/js/bootstrap.min.js");
?>
<!-- Angular -->
<?php
示例14:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<?php
echo CHtml::cssFile(Yii::app()->theme->baseUrl . '/css/style.css');
echo CHtml::cssFile(Yii::app()->baseUrl . '/js/highslide/highslide.css');
?>
<title><?php
echo $this->pageTitle;
?>
</title>
<?php
Yii::app()->clientScript->registerCoreScript('jquery');
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl . '/js/highslide/highslide.js', CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl . '/js/highslide/highslide_eh.js', CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl . '/js/highslide/highslide_eh.js', CClientScript::POS_HEAD);
?>
</head>
<body class="pagem">
<div id="container">
<div id="content">
<?php
echo $content;
?>
</div>
</div>
<script type="text/javascript">
示例15:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<meta charset="utf-8" />
<?php
// css
echo CHtml::cssFile('css/bootstrap.css');
echo CHtml::cssFile('css/ui-lightness/jquery-ui-1.10.3.custom.css');
// js
Yii::app()->clientScript->registerScriptFile('js/jquery-2.0.3.js');
Yii::app()->clientScript->registerScriptFile('js/jquery-ui-1.10.3.custom.js');
Yii::app()->clientScript->registerScriptFile('js/bootstrap.js');
Yii::app()->clientScript->registerScriptFile('js/numeral/numeral.js');
echo CHtml::cssFile('css/material/roboto.min.css');
echo CHtml::cssFile('css/material/material.min.css');
echo CHtml::cssFile('css/material/ripples.min.css');
Yii::app()->clientScript->registerScriptFile('js/material/ripples.js');
?>
<style>
label {
display: inline-block;
width: 150px;
text-align: right;
}
.form-control {
display: inline-block;
}
form div {
padding: 2px;
}