本文整理汇总了PHP中CHtml::css方法的典型用法代码示例。如果您正苦于以下问题:PHP CHtml::css方法的具体用法?PHP CHtml::css怎么用?PHP CHtml::css使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHtml
的用法示例。
在下文中一共展示了CHtml::css方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
}
示例2: 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;
}
}
示例3: array
echo CHtml::hiddenField('submit', 'true');
?>
<table class="detail-view">
<tr class="titlerow">
<td><?php
echo Yii::t('admin', 'Setting');
?>
</td>
<td></td>
<td><?php
echo Yii::t('admin', 'Default');
?>
</td>
</tr>
<?php
echo CHtml::css('.adv { display: none; }');
$i = 0;
$adv = false;
foreach ($settings as $name => $setting) {
if (@$setting['adv'] && !$adv) {
?>
<tr class="<?php
echo $i++ % 2 ? 'even' : 'odd';
?>
"style="height: 32px" >
<td><?php
echo Theme::img('icons/closed.png', '', array('id' => 'advImg', 'onclick' => 'return checkAdv()'));
?>
</td>
<td><?php
echo CHtml::link(Yii::t('admin', 'Show Advanced Options'), '#', array('id' => 'advTxt', 'onclick' => 'return checkAdv()'));
示例4: 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";
}
}
//.........这里部分代码省略.........
示例5: array
<?php
/**
*
* Copyright © 2010-2012 by xhost.ch GmbH
*
* All rights reserved.
*
**/
$this->pageTitle = Yii::app()->name . ' - ' . Yii::t('mc', 'Edit Config File');
$this->breadcrumbs = array(Yii::t('mc', 'Servers') => array('index'), $model->name => array('view', 'id' => $model->id), Yii::t('mc', 'Config Files') => array('configs', 'id' => $model->id), Yii::t('mc', 'Permissions Plugin'));
$this->menu = array(array('label' => Yii::t('mc', 'Back'), 'url' => array('server/configs', 'id' => $model->id), 'icon' => 'back'));
echo CHtml::css('table.detail-view .stdtable td { border: none }');
if ($error) {
?>
<div class="flash-error">
<?php
echo $error;
?>
</div>
<?php
}
$form = $this->beginWidget('CActiveForm', array('id' => 'cfgfile-form', 'enableAjaxValidation' => false));
function groupForm($role)
{
ob_start();
?>
<table class="stdtable">
<tr>
<td>
示例6: array
?>
</div>
<?php
}
if (Yii::app()->user->hasFlash('plugin_unpack')) {
?>
<div class="flash-success">
<?php
echo Yii::app()->user->getFlash('plugin_unpack');
?>
</div>
<?php
}
if (!$haveItems) {
?>
<?php
echo Yii::t('mc', 'There are no plugins available for the "JAR File" currently in use by the server.');
} else {
?>
<?php
$cols = array(array('name' => 'file', 'header' => Yii::t('mc', 'File'), 'value' => '$data["displayFile"]'), array('name' => 'desc', 'header' => Yii::t('mc', 'Description'), 'type' => 'html'), array('name' => 'status', 'header' => Yii::t('mc', 'Status'), 'headerHtmlOptions' => array('width' => '30'), 'htmlOptions' => array('style' => 'text-align: center'), 'type' => 'raw', 'value' => 'Theme::img("icons/plugin".$data["status"].".png", $data["status_alt"])'), array('header' => '', 'headerHtmlOptions' => array('width' => '120'), 'htmlOptions' => array('style' => 'text-align: center'), 'type' => 'raw', 'value' => '$data["action"]'));
echo CHtml::css('.topalign td { vertical-align: top }');
$this->widget('zii.widgets.grid.CGridView', array('id' => 'configs-grid', 'filter' => $filter, 'ajaxUpdate' => false, 'rowCssClass' => array('even topalign', 'odd topalign'), 'dataProvider' => $dataProvider, 'columns' => $cols));
?>
<?php
}
?>
示例7: init
public function init()
{
$path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'media';
$url = Yii::app()->getAssetManager()->publish($path);
$imgUrl = $url . '/print.gif';
echo CHtml::link("<img src=\"{$imgUrl}\" class=\"img_link\" title=\"" . Yii::t('lms', 'print') . "\">", "#", array_merge($this->htmlOptions, array('onclick' => 'return processPrint();')));
self::$count++;
if (self::$count == 1) {
$cs = Yii::app()->getClientScript();
$cs->registerCssFile($url . '/' . $this->cssFile);
Yii::app()->clientScript->registerCoreScript('jquery');
echo CHtml::script("\n var firstTime = true;\n function processPrint()\n {\n if (firstTime) {\n \$('{$this->coverElement}').addClass('printWidgetScreenCover');\n \n title = '{$this->title}';\n if (title != '')\n \$('<h3 class=\\'printWidgetPrintedElement\\'>'+title+'</h3>').appendTo('body');\n \n arrayEl = \$('{$this->printedElement}').get();\n for (var i=0; i<arrayEl.length; i++) {\n clonedEl = \$(arrayEl[i]).clone();\n clonedEl.addClass('printWidgetPrintedElement');\n clonedEl.appendTo('body');\n }\n \n firstTime = false;\n }\n window.print();\n return false;\n }\n ");
echo CHtml::css("\n .printWidgetScreenCover {display: none;}\n .printWidgetPrintedElement {display: block; padding-top:15px;margin-bottom: 0px;margin-top: 0px;margin-left: 20px;margin-right: 20px;}\n ", "print");
echo CHtml::css("\n .printWidgetPrintedElement {display: none;}\n ", "screen");
}
}
示例8: array
echo $this->renderPartial('application.views.headerReport.headerDefault', array('judulLaporan' => $judulLaporan));
?>
<?php
}
?>
<?php
echo CHtml::css('
label{
display:inline-block;
float:left;
width:200px;
padding-right:10px;
}
.item{
display:inline-block;
float:left;
}
.kanan{
text-align:right;
}
.kiri{
text-align:left;
}
');
?>
<table width="100%">
<tbody>
<tr>
<td width="50%" class='kanan'>
<div class="mws-form-row">
示例9: array
*
* Copyright © 2010-2012 by xhost.ch GmbH
*
* All rights reserved.
*
**/
$this->breadcrumbs = array(Yii::t('mc', 'Servers') => array('index'), $model->isNewRecord ? Yii::t('mc', 'New Server') : ($my ? 'Server' : CHtml::encode($model->name)));
Yii::app()->getClientScript()->registerCoreScript('jquery');
echo CHtml::css('
.adv { display: none; }
#advanced { display: none; }
#files { display: none; }
#buttons input
{
width: auto;
margin-left: -1px;
margin-right: 4px;
padding: 2px;
padding-left: 5px;
padding-right: 5px;
}
');
if (!$model->isNewRecord) {
$schedule = $manageUsers && (Yii::app()->user->isSuperuser() || $settings->user_schedule);
$mysql = $editConfigs && @strlen($model->mysqlHost) && (Yii::app()->params['user_mysql'] && $settings->user_mysql || Yii::app()->user->isSuperuser());
$bgPlugins = Yii::app()->params['use_bukget'];
$this->menu = array(array('label' => Yii::t('mc', 'Chat'), 'url' => array('chat', 'id' => $model->id), 'visible' => $chat, 'icon' => 'chat'), array('label' => $command ? Yii::t('mc', 'Console') : Yii::t('mc', 'Log'), 'url' => array('log', 'id' => $model->id), 'visible' => $viewLog, 'icon' => 'console'), array('label' => Yii::t('mc', 'Players'), 'url' => array('/player/index', 'sv' => $model->id), 'visible' => $manageUsers, 'icon' => 'player'), array('label' => Yii::t('mc', 'Files'), 'url' => 'javascript:showSub("files")', 'icon' => 'closed', 'linkOptions' => array('id' => 'files_main'), 'submenuOptions' => array('id' => 'files'), 'visible' => $editConfigs || $bgPlugins || $plugins || $manageUsers || $backup, 'items' => array(array('label' => Yii::t('mc', 'Config Files'), 'url' => array('configs', 'id' => $model->id), 'visible' => $editConfigs, 'icon' => 'config'), array('label' => Yii::t('mc', 'BukGet Plugins'), 'url' => array('bgPlugins', 'id' => $model->id), 'visible' => $bgPlugins ? true : false, 'icon' => 'plugin'), array('label' => Yii::t('mc', 'Local Plugins'), 'url' => array('plugins', 'id' => $model->id), 'visible' => $plugins, 'icon' => 'plugin'), array('label' => Yii::t('mc', 'FTP File Access'), 'url' => array(Yii::app()->params['ftp_client_disabled'] !== true ? '/ftpClient/index' : 'ftp', 'id' => $model->id), 'visible' => $manageUsers, 'icon' => 'file'), array('label' => Yii::t('mc', 'Backup'), 'url' => array('backup', 'id' => $model->id), 'visible' => $backup, 'icon' => 'backup'))), array('label' => Yii::t('mc', 'Advanced'), 'url' => 'javascript:showSub("advanced")', 'icon' => 'closed', 'linkOptions' => array('id' => 'advanced_main'), 'submenuOptions' => array('id' => 'advanced'), 'visible' => $manageUsers || $schedule || $mysql, 'items' => array(array('label' => Yii::t('mc', 'Commands'), 'url' => array('/command/index', 'sv' => $model->id), 'visible' => $manageUsers, 'icon' => 'command'), array('label' => Yii::t('mc', 'Scheduled Tasks'), 'url' => array('/schedule/index', 'sv' => $model->id), 'visible' => $schedule, 'icon' => 'schedule'), array('label' => Yii::t('mc', 'Users'), 'url' => array('users', 'id' => $model->id), 'visible' => $manageUsers, 'icon' => 'user'), array('label' => Yii::t('mc', 'MySQL Database'), 'url' => array('mysqlDb', 'id' => $model->id), 'visible' => $mysql, 'icon' => 'mysql'))), array('label' => Yii::t('mc', 'Delete Server'), 'url' => array('delete', 'id' => $model->id), 'visible' => $delete, 'icon' => 'delete'));
} else {
$this->menu = array(array('label' => Yii::t('mc', 'Back'), 'url' => array('index'), 'icon' => 'back'));
}
示例10: 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 .= '<script type="text/javascript" src="' . $scriptFile . '" charset="utf-8"></script>' . "\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;
}
}
}
示例11: array
*
* Copyright © 2010-2012 by xhost.ch GmbH
*
* All rights reserved.
*
**/
$this->pageTitle = Yii::app()->name . ' - ' . Yii::t('mc', 'About');
$this->breadcrumbs = array(Yii::t('mc', 'About'));
$this->menu = array(array('label' => Yii::t('mc', 'Back'), 'url' => array('', 'view' => 'home'), 'icon' => 'back'));
echo CHtml::css('
.stdtable td
{
padding: 20px;
background-color: white;
text-align: center;
border-top: 1px solid #dfdfdf;
}
.stdtable td.left
{
border-right: 1px solid #dfdfdf;
}
');
?>
<div style="margin-right: -8px; float: right"><?php
echo Theme::img('about/swissmade.png');
?>
</div>
<br/>
<h2><?php
echo Yii::t('mc', 'About Multicraft');
?>
示例12:
echo CHtml::css('
table.result
{
background:#f0f1f4 none repeat scroll 0% 0%;
border-collapse:collapse;
width:100%;
}
table.result th
{
background:#888;
color: #fff;
text-shadow: 0px 1px 0px #555555;
text-align:left;
font-weight: normal;
}
table.result th, table.result td
{
border-bottom: 1px solid #dedede;
padding: 6px;
}
td.passed
{
background-color: #60BF60;
border: 1px solid silver;
padding: 2px;
color: #fff;
text-shadow: 0px 1px 0px #555;
}
td.warning
{
background-color: #FFFFBF;
border: 1px solid silver;
padding: 2px;
color: #555;
text-shadow: 0px 0px 0px;
}
td.failed
{
background-color: #FF8080;
border: 1px solid silver;
padding: 2px;
color: #fff;
text-shadow: 0px 1px 0px #555;
}
');
示例13: someCss
/**
* @desc some CSS...
*/
private function someCss()
{
echo CHtml::css(".hide-print {display: none;}", "print");
echo CHtml::css("#mprint {cursor: 'pointer';}", "screen");
}
示例14: testCss
/**
* @dataProvider providerCss
*
* @param string $text
* @param string $media
* @param string $assertion
*/
public function testCss($text, $media, $assertion)
{
$this->assertEquals($assertion, CHtml::css($text, $media));
}
示例15: 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;
}
}
}