当前位置: 首页>>代码示例>>PHP>>正文


PHP Html::cssFile方法代码示例

本文整理汇总了PHP中yii\helpers\Html::cssFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::cssFile方法的具体用法?PHP Html::cssFile怎么用?PHP Html::cssFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\helpers\Html的用法示例。


在下文中一共展示了Html::cssFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

<!DOCTYPE html>
<html lang="<?php 
echo Yii::$app->language;
?>
">
<head>
    <meta charset="<?php 
echo Yii::$app->charset;
?>
">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?php 
echo Html::cssFile('@web/css/temp.css');
?>
    <?php 
echo Html::cssFile('@web/css/dev.css');
?>
    <?php 
echo Html::csrfMetaTags();
?>
    <title><?php 
echo Html::encode($this->title);
?>
</title>
    <?php 
$this->head();
?>
</head>
<body>
<?php 
$this->beginBody();
开发者ID:schw,项目名称:SGE3,代码行数:31,代码来源:main.php

示例2: minifyCSS

 /**
  * @return self
  */
 protected function minifyCSS()
 {
     if (!empty($this->cssFiles)) {
         $css_files = array_keys($this->cssFiles);
         $css_minify_file = $this->minify_path . '/' . $this->_getSummaryFilesHash($this->cssFiles) . '.css';
         if (!file_exists($css_minify_file)) {
             $css = '';
             foreach ($css_files as $file) {
                 $file = preg_replace("#\\?v=\\d{1,}\$#i", '', $file);
                 $content = file_get_contents($this->getBasePath($file));
                 preg_match_all('|url\\(([^)]+)\\)|is', $content, $m);
                 if (!empty($m[0])) {
                     $path = dirname($file);
                     $result = [];
                     foreach ($m[0] as $k => $v) {
                         if (0 === strpos($m[1][$k], 'data:')) {
                             continue;
                         }
                         $url = str_replace(['\'', '"'], '', $m[1][$k]);
                         if ($this->isUrl($url)) {
                             $result[$m[1][$k]] = '\'' . $url . '\'';
                         } else {
                             $result[$m[1][$k]] = '\'' . $path . '/' . $url . '\'';
                         }
                     }
                     $content = str_replace(array_keys($result), array_values($result), $content);
                 }
                 $css .= $content;
             }
             $this->expandImports($css);
             $css = (new \CSSmin())->run($css, $this->css_linebreak_pos);
             if (false !== $this->force_charset) {
                 $charsets = '@charset "' . (string) $this->force_charset . '";' . "\n";
             } else {
                 $charsets = $this->collectCharsets($css);
             }
             $imports = $this->collectImports($css);
             $fonts = $this->collectFonts($css);
             file_put_contents($css_minify_file, $charsets . $imports . $fonts . $css);
             if (false !== $this->file_mode) {
                 chmod($css_minify_file, $this->file_mode);
             }
         }
         //            // debug info ------------------------------------------------------
         //            \common\components\log\AppLogger::info([
         //                'method'                => __METHOD__,
         //                'line'                  => __LINE__,
         //                '$this->base_path'      => $this->base_path,
         //                'alias'                 => $this->getBasePath(),
         //                '$this->minify_path'    => $this->minify_path,
         //                '$css_minify_file'      => $css_minify_file,
         //            ]);
         //            // -----------------------------------------------------------------
         $css_file = str_replace($this->getBasePath(), '', $css_minify_file);
         $this->cssFiles = [$css_file => helpers\Html::cssFile($css_file)];
     }
     return $this;
 }
开发者ID:snivs,项目名称:semanti,代码行数:61,代码来源:View.php

示例3: addCssFiles

 /**
  * Registers Css
  */
 public function addCssFiles($cssFiles, $options = [])
 {
     $url = $this->getUrlByFiles($cssFiles);
     if (Yii::$app->controller->layout) {
         Yii::$app->getView()->registerCssFile($url, $options);
     } else {
         echo Html::cssFile($url, $options);
     }
 }
开发者ID:aiddroid,项目名称:yii2-assets-combine,代码行数:12,代码来源:AssetsCombine.php

示例4: _processingCssFiles

 /**
  * @param array $files
  * @return array
  */
 protected function _processingCssFiles($files = [])
 {
     $fileName = md5(implode(array_keys($files)) . $this->getSettingsHash()) . '.css';
     $publicUrl = Yii::getAlias('@web/assets/css-compress/' . $fileName);
     $rootDir = Yii::getAlias('@webroot/assets/css-compress');
     $rootUrl = $rootDir . '/' . $fileName;
     if (file_exists($rootUrl)) {
         $resultFiles = [];
         foreach ($files as $fileCode => $fileTag) {
             if (!Url::isRelative($fileCode) && !$this->cssFileRemouteCompile) {
                 $resultFiles[$fileCode] = $fileTag;
             }
         }
         $publicUrl = $publicUrl . "?v=" . filemtime($rootUrl);
         $resultFiles[$publicUrl] = Html::cssFile($publicUrl);
         return $resultFiles;
     }
     $resultContent = [];
     $resultFiles = [];
     foreach ($files as $fileCode => $fileTag) {
         if (Url::isRelative($fileCode)) {
             $contentTmp = trim($this->fileGetContents(Url::to(Yii::$app->request->hostInfo . $fileCode, true)));
             $fileCodeTmp = explode("/", $fileCode);
             unset($fileCodeTmp[count($fileCodeTmp) - 1]);
             $prependRelativePath = implode("/", $fileCodeTmp) . "/";
             $contentTmp = \Minify_CSS::minify($contentTmp, ["prependRelativePath" => $prependRelativePath, 'compress' => true, 'removeCharsets' => true, 'preserveComments' => true]);
             //$contentTmp = \CssMin::minify($contentTmp);
             $resultContent[] = $contentTmp;
         } else {
             if ($this->cssFileRemouteCompile) {
                 //Trying to download a remote file
                 $resultContent[] = trim($this->fileGetContents($fileCode));
             } else {
                 $resultFiles[$fileCode] = $fileTag;
             }
         }
     }
     if ($resultContent) {
         $content = implode($resultContent, "\n");
         if (!is_dir($rootDir)) {
             if (!FileHelper::createDirectory($rootDir, 0777)) {
                 return $files;
             }
         }
         if ($this->cssFileCompress) {
             $content = \CssMin::minify($content);
         }
         $file = fopen($rootUrl, "w");
         fwrite($file, $content);
         fclose($file);
     }
     if (file_exists($rootUrl)) {
         $publicUrl = $publicUrl . "?v=" . filemtime($rootUrl);
         $resultFiles[$publicUrl] = Html::cssFile($publicUrl);
         return $resultFiles;
     } else {
         return $files;
     }
 }
开发者ID:iisns,项目名称:yii2-assets-compress,代码行数:63,代码来源:AssetsCompressComponent.php

示例5:

<?php

use yii\helpers\Html;
use yii\helpers\Url;
/* @var $this yii\web\View */
$this->title = 'My Yii Application';
$upload = yii::$app->request->baseUrl . '/../../backend/web/upload/';
echo Html::cssFile('@web/css/bootstrap.css');
?>

<?php 
$this->beginBlock('inline_styles');
?>
<style>
    .cy-rg1ph input{
        width: 88%;
        float: right;
        margin-right: 4%;
        color: #c8c8c8;
    }
    .cy-rg1ph label{
        color: #c8c8c8;
        font-weight: normal;
        float: left;
        display: block;
        width: 5%;

    }

</style>
<?php 
开发者ID:wuwenhan,项目名称:huoqiwang,代码行数:31,代码来源:login.php

示例6: registerCssFile

 /**
  * Registers a CSS file.
  * @param string $url the CSS file to be registered.
  * @param array $options the HTML attributes for the link tag. Please refer to [[Html::cssFile()]] for
  * the supported options. The following options are specially handled and are not treated as HTML attributes:
  *
  * - `depends`: array, specifies the names of the asset bundles that this CSS file depends on.
  *
  * @param string $key the key that identifies the CSS script file. If null, it will use
  * $url as the key. If two CSS files are registered with the same key, the latter
  * will overwrite the former.
  */
 public function registerCssFile($url, $options = [], $key = null)
 {
     $url = Yii::getAlias($url);
     $key = $key ?: $url;
     $depends = ArrayHelper::remove($options, 'depends', []);
     if (empty($depends)) {
         $this->cssFiles[$key] = Html::cssFile($url, $options);
     } else {
         $this->getAssetManager()->bundles[$key] = Yii::createObject(['class' => AssetBundle::className(), 'baseUrl' => '', 'css' => [strncmp($url, '//', 2) === 0 ? $url : ltrim($url, '/')], 'cssOptions' => $options, 'depends' => (array) $depends]);
         $this->registerAssetBundle($key);
     }
 }
开发者ID:Abbas-Hashemian,项目名称:yii2,代码行数:24,代码来源:View.php

示例7:

<!DOCTYPE html>
<html lang="<?php 
echo Yii::$app->language;
?>
">
<head>
    <meta charset="<?php 
echo Yii::$app->charset;
?>
">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?php 
echo Html::csrfMetaTags();
?>
    <?php 
echo Html::cssFile('frontend/web/css/layout.css');
?>
    <?php 
echo Html::jsFile('frontend/web/js/jquery-1.8.1.min.js');
?>
    <title><?php 
echo Html::encode('YII2');
?>
</title>
    <?php 
$this->head();
?>
</head>
<body>
    <?php 
$this->beginBody();
开发者ID:jia253,项目名称:centosYii2,代码行数:31,代码来源:main.php

示例8: function

                <div class="nav-item-inner nav-marketing">文章管理</div>
            </li>
        </ul>
    </div>
    <ul id="J_NavContent" class="dl-tab-conten">

    </ul>
</div>



<?php 
echo Html::cssFile('@web/assets/css/dpl-min.css');
echo Html::cssFile('@web/assets/css/bui-min.css');
echo Html::cssFile('@web/assets/css/main-min.css');
echo Html::cssFile('@web/css/site.css');
echo Html::jsFile('@web/assets/js/jquery-1.8.1.min.js');
echo Html::jsFile('@web/assets/js/bui-min.js');
echo Html::jsFile('@web/assets/js/common/main-min.js');
echo Html::jsFile('@web/assets/js/config-min.js');
?>


<script>
    BUI.use('common/main', function () {
        var config = [{
            id: 'menu',
            menu: [{
                text: '用户信息修改',
                items: [
                    {
开发者ID:xiaohongyang,项目名称:yii_shop,代码行数:31,代码来源:index.php

示例9: processMinifyCss

 /**
  * @param array $files
  */
 protected function processMinifyCss($files)
 {
     $resultFile = $this->minify_path . '/' . $this->_getSummaryFilesHash($files) . '.css';
     if (!file_exists($resultFile)) {
         $css = '';
         foreach ($files as $file => $html) {
             $path = dirname($file);
             $file = $this->getAbsoluteFilePath($file);
             $content = file_get_contents($file);
             preg_match_all('|url\\(([^)]+)\\)|is', $content, $m);
             if (!empty($m[0])) {
                 $result = [];
                 foreach ($m[0] as $k => $v) {
                     if (in_array(strpos($m[1][$k], 'data:'), [0, 1], true)) {
                         continue;
                     }
                     $url = str_replace(['\'', '"'], '', $m[1][$k]);
                     if ($this->isUrl($url)) {
                         $result[$m[1][$k]] = '\'' . $url . '\'';
                     } else {
                         $result[$m[1][$k]] = '\'' . $path . '/' . $url . '\'';
                     }
                 }
                 $content = str_replace(array_keys($result), array_values($result), $content);
             }
             $css .= $content;
         }
         $this->expandImports($css);
         $this->removeCssComments($css);
         $css = (new \CSSmin())->run($css, $this->css_linebreak_pos);
         if (false !== $this->force_charset) {
             $charsets = '@charset "' . (string) $this->force_charset . '";' . "\n";
         } else {
             $charsets = $this->collectCharsets($css);
         }
         $imports = $this->collectImports($css);
         $fonts = $this->collectFonts($css);
         file_put_contents($resultFile, $charsets . $imports . $fonts . $css);
         if (false !== $this->file_mode) {
             @chmod($resultFile, $this->file_mode);
         }
     }
     $file = sprintf('%s%s', \Yii::getAlias($this->web_path), str_replace(\Yii::getAlias($this->base_path), '', $resultFile));
     $this->cssFiles[$file] = helpers\Html::cssFile($file);
 }
开发者ID:audriusdob,项目名称:yii2-minify-view,代码行数:48,代码来源:View.php

示例10:

use yii\bootstrap\ActiveForm;
use yii\captcha\Captcha;
$this->title = 'Contact';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="site-contact">
    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <hr>
    <?php 
echo Html::tag('hoogl', '111', ['class' => 'hoogl', 'data' => '1212']);
?>
    <?php 
echo Html::cssFile('/asssets/q.css');
?>
    <?php 
print_r(Html::cssStyleFromArray(['width' => '100px', 'height' => '200px']));
?>
    <hr>

    <?php 
if (Yii::$app->session->hasFlash('contactFormSubmitted')) {
    ?>

        <div class="alert alert-success">
            Thank you for contacting us. We will respond to you as soon as possible.
        </div>

        <p>
开发者ID:hoogl,项目名称:phponeday,代码行数:31,代码来源:contact.php

示例11: registerCssFile

 /**
  * Registers a CSS file.
  * @param string $url the CSS file to be registered.
  * @param array $options the HTML attributes for the link tag. Please refer to [[Html::cssFile()]] for
  * the supported options. The following options are specially handled and are not treated as HTML attributes:
  *
  * - `depends`: array, specifies the names of the asset bundles that this CSS file depends on.
  *
  * @param string $key the key that identifies the CSS script file. If null, it will use
  * $url as the key. If two CSS files are registered with the same key, the latter
  * will overwrite the former.
  */
 public function registerCssFile($url, $options = [], $key = null)
 {
     $url = Yii::getAlias($url);
     $key = $key ?: $url;
     $depends = ArrayHelper::remove($options, 'depends', []);
     if (empty($depends)) {
         $this->cssFiles[$key] = Html::cssFile($url, $options);
     } else {
         $this->getAssetManager()->bundles[$key] = new AssetBundle(['baseUrl' => '', 'css' => [ltrim($url, '/')], 'cssOptions' => $options, 'depends' => (array) $depends]);
         $this->registerAssetBundle($key);
     }
 }
开发者ID:aivavic,项目名称:yii2,代码行数:24,代码来源:View.php

示例12:

">
<head>
    <meta charset="<?php 
echo Yii::$app->charset;
?>
">
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <?php 
echo Html::cssFile('backend/web/css/dpl-min.css');
?>
 
    <?php 
echo Html::cssFile('backend/web/css/bui-min.css');
?>
    <?php 
echo Html::cssFile('backend/web/css/main-min.css');
?>
 
    <?php 
echo Html::jsFile('backend/web/js/jquery-1.8.1.min.js');
?>
    <?php 
echo Html::jsFile('backend/web/js/bui-min.js');
?>
     <?php 
echo Html::jsFile('backend/web/js/main-min.js');
?>
      <?php 
echo Html::jsFile('backend/web/js/config-min.js');
?>
    <?php 
开发者ID:jia253,项目名称:centosYii2,代码行数:31,代码来源:index.php

示例13:

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title><?php 
echo Html::encode($this->title . ' / ' . Yii::t('app', 'Control Panel'));
?>
</title>
  <?php 
echo Html::csrfMetaTags();
?>
  <?php 
$this->head();
?>
  <?php 
echo Html::cssFile('/assets/' . ArrayHelper::getValue(Yii::$app->params['assets'], 'admin.css'));
?>
</head>
<body>
<?php 
$this->beginBody();
?>
  <?php 
if (Yii::$app->controller->action->id == 'login') {
    ?>
  <div class="container">
    <?php 
    echo $content;
    ?>
  </div>
  <?php 
开发者ID:rkit,项目名称:bootstrap-yii2,代码行数:31,代码来源:admin.php

示例14: filemtime

        <!--[if lte IE 9 ]>
           <link rel="stylesheet" href="https://libs.cdn.renault.com/etc/designs/renault_v2/2.3.0-92/common-assets/css/pre-ie10.min.css">
        <![endif]-->

        <link rel="icon" type="image/png" href="/favicon.ico">
        <?php 
$this->head();
?>
        <?php 
echo Html::csrfMetaTags();
?>
        <?php 
echo Html::cssFile(YII_DEBUG ? '@web/css/all.css?v=' . filemtime(Yii::getAlias('@webroot/css/all.min.css')) : '@web/css/all.min.css?v=' . filemtime(Yii::getAlias('@webroot/css/all.min.css')));
?>
        <?php 
echo Html::cssFile('@web/plugins/rs-plugin/css/settings.css?v=' . filemtime(Yii::getAlias('@webroot/plugins/rs-plugin/css/settings.css')));
echo DbText::widget(['key' => 'frontend.code.head.end', 'domain_id' => Yii::getAlias('@domainId')]);
?>
    </head>
    <body>
<?php 
$this->beginBody();
?>


        <main id="container" role="main">
<?php 
echo $content;
?>
        </main>
开发者ID:allhaze,项目名称:renault,代码行数:30,代码来源:proxy_test.php

示例15:

echo Html::tag('div', 'sdsdsd dddd', $options);
$id = 2;
$option = [['id' => 1, 'name' => 'one'], ['id' => 2, 'name' => 'two'], ['id' => 3, 'name' => 'three'], ['id' => 4, 'name' => 'four']];
$post = ['title' => 'this is title', 'name' => 'this is name', 'child' => [1000, 200]];
echo Html::getInputName($model, 'username');
echo Html::getAttributeValue($model, 'username');
echo Html::tag('hr');
echo Html::getInputId($model, 'username');
echo Html::tag('hr');
?>

<?php 
echo Html::style('.username{color:red;font-size:8px;}');
echo Html::script('alert("script is test")', ['defer' => true]);
echo Html::tag('br/');
echo Html::cssFile('@web/css/ie5.css', ['condition' => 'IE 5']);
echo Html::jsFile('@web/js/main.js');
echo Html::a('超链接', ['home/list', 'id' => 12], ['class' => 'link']);
echo Html::mailto('Contact Us', 'xingcuntian@163.com');
echo Html::img('@web/images/logo.png', ['alt' => 'logo']);
?>
<hr/>

<?php 
echo Html::beginForm(['home/add', 'id' => $id], 'post', ['enctype' => 'multipart/form-data']);
echo Html::input('text', 'username', 'name', ['class' => 'name']);
echo Html::radio('agree', true, ['label' => 'this is radio']);
echo Html::checkbox('agree', true, ['label' => 'this is checkbox']);
?>

<?php 
开发者ID:xingcuntian,项目名称:component_test,代码行数:31,代码来源:index.php


注:本文中的yii\helpers\Html::cssFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。