<!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();
/** * @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; }
/** * 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); } }
/** * @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; } }
<?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
/** * 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); } }
<!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();
<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: [ {
/** * @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); }
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>
/** * 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); } }
"> <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
<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
<!--[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>
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', '*****@*****.**'); 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
/** * @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)) { } else { if (!$this->cssFileRemouteCompile) { $resultFiles[$fileCode] = $fileTag; } } } $publicUrl = $publicUrl . "?v=" . filemtime($rootUrl); $resultFiles[$publicUrl] = Html::cssFile($publicUrl); return $resultFiles; } //Reading the contents of the files try { $resultContent = []; $resultFiles = []; foreach ($files as $fileCode => $fileTag) { if (Url::isRelative($fileCode)) { $contentTmp = trim($this->fileGetContents(Url::to(\Yii::getAlias($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) { //Пытаемся скачать удаленный файл $resultContent[] = trim($this->fileGetContents($fileCode)); } else { $resultFiles[$fileCode] = $fileTag; } } } } catch (\Exception $e) { \Yii::error($e->getMessage(), static::className()); return $files; } if ($resultContent) { $content = implode($resultContent, "\n"); if (!is_dir($rootDir)) { if (!FileHelper::createDirectory($rootDir, 0777)) { return $files; } } if ($this->cssFileCompress) { $content = \CssMin::minify($content); } $page = \Yii::$app->request->absoluteUrl; $useFunction = function_exists('curl_init') ? 'curl extension' : 'php file_get_contents'; $filesString = implode(', ', array_keys($files)); \Yii::info("Create css file: {$publicUrl} from files: {$filesString} to use {$useFunction} on page '{$page}'", static::className()); $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; } }
<?php echo HTML::csrfMetaTags(); ?> <title><?php echo $this->title; ?> </title> <?php $this->head(); ?> <!-- <link href="http://fonts.useso.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css" />--> <?php echo Html::cssFile("@web/css/adminshop.css"); ?> <script type="text/javascript"> <?php if (is_array(Yii::$app->params['lang']) && count(Yii::$app->params['lang'])) { foreach (Yii::$app->params['lang']['js_languages'] as $_k => $_v) { ?> var <?php echo $_k; ?> ="<?php
<?php use yii\helpers\Html; ?> <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>消息中心</title> <?php echo Html::cssFile('@web/css/bootstrap.min.css'); ?> <?php echo Html::cssFile('@web/css/style.css'); ?> <?php echo Html::jsFile('@web/Js/jquery.js'); ?> </head> <body> <?php echo $this->render('_form', ['model' => $model]); ?> </body> </html>
protected function saveOptimizedCssFile($content) { $finalPath = $this->saveFile($content, $this->publishPath, 'css'); $finalUrl = $this->publishUrl . DIRECTORY_SEPARATOR . basename($finalPath); $this->cssFiles[$finalPath] = Html::cssFile($finalUrl); }
<meta http-equiv=X-UA-Compatible content=IE=edge> <title>利润表</title> <?php echo Html::jsFile('@web/Js/jquery.js'); ?> <?php echo Html::cssFile('@web/css/bootstrap.min.css'); ?> <?php echo Html::jsFile('@web/Js/bootstrap.js'); ?> <?php echo Html::cssFile('@web/Js/handsontable/handsontable.css'); ?> <?php echo Html::cssFile('@web/Js/handsontable/css/samples.css'); ?> <?php echo Html::jsFile('@web/Js/handsontable/pikaday/pikaday.js'); ?> <?php echo Html::jsFile('@web/Js/handsontable/moment/moment.js'); ?> <?php echo Html::jsFile('@web/Js/handsontable/zeroclipboard/zeroclipboard.js'); ?> <?php echo Html::jsFile('@web/Js/handsontable/handsontable.js'); ?> <?php echo Html::jsFile('@web/Js/WdatePicker/WdatePicker.js');
<?php use yii\captcha\Captcha; use yii\helpers\Html; ?> <?php echo Html::cssFile("@web/source/admin/css/public/login.css"); ?> <div class="container"> <div class="row"> <div class=" logcen test"> <?php $form = \yii\widgets\ActiveForm::begin(['id' => 'login-form', 'options' => ['class' => 'form-horizontal'], 'fieldConfig' => ['template' => "{label}\n<div class=\"col-lg-4\">{input}</div>\n<div class=\"col-lg-5\">{error}</div>", 'labelOptions' => ['class' => 'col-lg-3 control-label'], 'inputOptions' => ['class' => 'form-control']], 'enableAjaxValidation' => false]); ?> <div class=""> <h3 class="col-md-offset-1"><?php echo Yii::t('webinfo', 'webname'); echo Yii::t('webinfo', 'backForm'); ?> :</h3> <div class="margin-top-small" style="margin-top: 40px;"> </div> <?php echo $form->field($model, 'username')->textInput(['placeholder' => '请输入用户名']);
<?php use yii\base\View; use yii\helpers\Html; $directoryAsset = Yii::$app->assetManager->getPublishedUrl('@almasaeed/'); $this->title = '提现'; echo Html::cssFile('@web/myAssetsLib/css/bootstrap.css'); echo Html::jsFile('@web/myAssetsLib/js/jquery-1.9.1.min.js'); echo Html::jsFile('@web/myAssetsLib/js/bootstrap.js'); echo Html::jsFile('@web/myAssetsLib/js/bootbox.js'); ?> <div class="main aqbz"> <div class="left" id="left"> <div class="page-con4"> <p class="page-con41"><a href="<?php echo yii\helpers\Url::to(['setting/setting']); ?> "><img width="100px" height="100px" src="<?php echo yii::$app->homeUrl; ?> upload/<?php echo $model["person_face"]; ?> " alt="头像" /></a></p> <?php if (yii::$app->user->identity->real_name) { ?> <p><?php echo yii::$app->user->identity->real_name; ?>
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; ?> <!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"> <head> <title>CMS管理面板</title> <meta name="robots" content="noindex, nofollow"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <?php echo Html::cssFile('@web/assets/admin_assets/css/login.css'); ?> </head> <body> <div class="login"> <h1><a href="javascript:;">CMS</a></h1> <?php $form = ActiveForm::begin(['options' => ['class' => 'clearfix']]); ?> <p> <label>管理员帐号:<?php echo Html::activeInput('text', $model, 'username', ['class' => 'input']); ?> </label> <span style="color: red"><?php if ($error = $model->getErrors('username')) { echo $error[0]; } ?>
/** * Generate default messages */ public function generateMessages() { if (!isset($this->footerMessage)) { $this->footerMessage = $this->getFooterMessage(); } if (!isset($this->emptyPreview)) { $this->emptyPreview = '<p class="help-block text-center">' . Yii::t('markdown', 'No content to display') . '</p>'; } $exportAlert = 'Your {type} file will be generated and downloaded as {filename}.'; $popupAlert = Yii::t('markdown', 'Disable any popup blockers in your browser to ensure proper download.'); if (empty($this->exportFileName)) { $this->exportFileName = Yii::t('markdown', 'markdown-export'); } if (!isset($this->exportTextAlert)) { $this->exportTextAlert = Yii::t('markdown', $exportAlert, ['type' => Yii::t('markdown', 'TEXT'), 'filename' => $this->exportFileName . '.txt']) . "\n\n" . $popupAlert; } if (!isset($this->exportHtmlAlert)) { $this->exportHtmlAlert = Yii::t('markdown', $exportAlert, ['type' => Yii::t('markdown', 'HTML'), 'filename' => $this->exportFileName . '.htm']) . "\n\n" . $popupAlert; } if (!isset($this->exportHeader)) { $this->exportHeader = "> - - -\n> " . Yii::t('markdown', "Markdown Export{line} *Generated {date} by {class}", ['line' => "\n> ===============\n>", 'date' => date("d-M-Y H:i"), 'class' => "\\kartik\\markdown\\MarkdownEditor*\n> - - -\n\n"]); } if (!isset($this->exportCss)) { $this->exportCss = Html::cssFile($this->bootstrapCssFile) . "\n" . Html::style('body{margin:20px;padding:20px;border:1px solid #ddd;border-radius:5px;}' . 'th[align="right"]{text-align:right!important;}' . 'th[align="center"]{text-align:center!important;}'); } if (!isset($this->previewProgress)) { $this->previewProgress = '<div class="kv-loading">' . Yii::t('markdown', 'Loading Preview') . ' …</div>'; } }
/** * @param array $files */ protected function process(array $files) { $resultFile = $this->view->minify_path . DIRECTORY_SEPARATOR . $this->_getSummaryFilesHash($files) . '.css'; if (!file_exists($resultFile)) { $css = ''; foreach ($files as $file => $html) { $path = dirname($file); $file = $this->getAbsoluteFilePath($file); $content = ''; if (!file_exists($file)) { \Yii::warning(sprintf('Asset file not found `%s`', $file), __METHOD__); } elseif (!is_readable($file)) { \Yii::warning(sprintf('Asset file not readable `%s`', $file), __METHOD__); } else { $content = file_get_contents($file); } $result = []; preg_match_all('|url\\(([^)]+)\\)|is', $content, $m); if (!empty($m[0])) { 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 = strtr($content, $result); } $css .= $content; } $this->expandImports($css); $this->removeCssComments($css); if ($this->view->minifyCss) { $css = (new \CSSmin())->run($css, $this->view->css_linebreak_pos); } $charsets = false !== $this->view->force_charset ? '@charset "' . (string) $this->view->force_charset . '";' . "\n" : $this->collectCharsets($css); $imports = $this->collectImports($css); $fonts = $this->collectFonts($css); file_put_contents($resultFile, $charsets . $imports . $fonts . $css); if (false !== $this->view->file_mode) { @chmod($resultFile, $this->view->file_mode); } } $file = $this->prepareResultFile($resultFile); $this->view->cssFiles[$file] = Html::cssFile($file); }
/** * Registers a CSS file. * @param string $url the CSS file to be registered. * @param array $depends the names of the asset bundles that this CSS file depends on * @param array $options the HTML attributes for the link tag. * @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, $depends = [], $options = [], $key = null) { $key = $key ?: $url; if (empty($depends)) { $this->cssFiles[$key] = Html::cssFile($url, $options); } else { $am = Yii::$app->getAssetManager(); $am->bundles[$key] = new AssetBundle(['css' => [$url], 'cssOptions' => $options, 'depends' => (array) $depends]); $this->registerAssetBundle($key); } }
public function testCssFile() { $this->assertEquals('<link href="http://example.com" rel="stylesheet">', Html::cssFile('http://example.com')); $this->assertEquals('<link href="/test" rel="stylesheet">', Html::cssFile('')); }
use app\assets\AppAsset; use yii\widgets\ActiveForm; ?> <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <?php echo Html::cssFile('@web/css/bootstrap.min.css'); ?> <?php echo Html::cssFile('@web/css/site.css'); ?> <?php echo Html::cssFile('@web/css/jquery.Jcrop.css'); ?> <?php echo Html::jsFile('@web/Js/jquery.js'); ?> <?php echo Html::jsFile('@web/Js/ajaxupload.js'); ?> <?php echo Html::jsFile('@web/Js/jquery.Jcrop.min.js'); ?> <?php echo Html::jsFile('@web/Js/bootstrap.js'); ?> <title>用户管理</title>
<meta name="msapplication-TileImage" content="<?php echo Yii::getAlias('@web/ms-icon-144x144.png'); ?> "> <meta name="theme-color" content="#4394F0"> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> <![endif]--> <?php echo Html::csrfMetaTags(); ?> <?php echo Html::cssFile(YII_DEBUG ? '@web/css/all.css' : '@web/css/all.min.css?v=' . filemtime(Yii::getAlias('@webroot/css/all.min.css'))); ?> <?php $this->registerJs('yiiBaseUrl = ' . \yii\helpers\Json::htmlEncode(Yii::$app->request->getBaseUrl()), \yii\web\View::POS_HEAD); ?> <link href='https://fonts.googleapis.com/css?family=Josefin+Sans:600|Open+Sans' rel='stylesheet' type='text/css'> <title><?php if (!empty($this->title)) { echo Html::encode($this->title); ?> - <?php } ?> Yii PHP Framework</title>
<?php use yii\helpers\Html; use yii\base\ErrorException; use common\models\cms\Category; use backend\models\Article; $directoryAsset = Yii::$app->assetManager->getPublishedUrl('@almasaeed/'); echo Html::cssFile('@web/myAssetsLib/css/style.css'); try { $parent_id = Category::findOne(['title' => '帮助中心', 'status' => 1])->id; $category = Category::find()->where(['parent_id' => $parent_id, 'status' => 1])->asArray()->all(); $left = array(); foreach ($category as $K => $V) { $has_parent_id = Category::find()->where(['parent_id' => $V['id'], 'status' => 1])->asArray()->all(); //var_dump($has_parent_id);exit; $left_second = array(); if ($has_parent_id) { foreach ($has_parent_id as $K1 => $V1) { $left_second[] = Category::find()->where(['id' => $V1['id'], 'status' => 1])->asArray()->all(); } } if (count($left_second) > 0) { $temp = Article::find()->where(['category_id' => $V['id'], 'status' => 1])->asArray()->all(); foreach ($left_second as $K_slice => $V_slice) { $temp = array_merge($temp, $left_second[$K_slice]); } $left[] = $temp; } else { $left[] = Article::find()->where(['category_id' => $V['id'], 'status' => 1])->asArray()->all(); } }