本文整理汇总了PHP中HTML::style方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::style方法的具体用法?PHP HTML::style怎么用?PHP HTML::style使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::style方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderStyles
public static function renderStyles(){
if (count(self::$_styles) == 0)
return FALSE;
self::$_styles = array_unique(self::$_styles);
switch ( Kohana::$environment){
case Kohana::DEVELOPMENT:
case Kohana::STAGING:
case kohana::TESTING:
default:
foreach (self::$_styles as $style){
echo HTML::style("media/styles/".$style);
}
break;
case Kohana::PRODUCTION:
?><link rel='stylesheet' type='text/css' href='<?php
echo url::base();
?>
min/index.php?b=media/styles&f=<?php
echo implode(",", self::$_styles);
?>
' /><?
break;
}
}
示例2: action_index
public function action_index()
{
$this->template->header->css = HTML::style("themes/default/media/css/home.css");
$this->template->header->title = __('Welcome');
$this->template->content = View::factory('pages/welcome/main');
$this->template->content->set(array('public_registration_enabled' => (bool) Swiftriver::get_setting('public_registration_enabled'), 'anonymous' => $this->anonymous));
}
示例3: addStyle
/**
* Add style
*
* @param string $path
*/
public function addStyle($path, $media = 'screen')
{
if (Filesystem::getExtension($path) == 'css') {
isset($this->styles->{$media}) or $this->styles->{$media} = new Core_ArrayObject();
$this->styles->{$media}->{$path} = HTML::style(self::preparePath($path), array('media' => $media));
}
}
示例4: render
public function render()
{
// calculate the dependencies just once
!$this->_loaded_dependencies and $this->load_dependencies();
// sort the assets
usort($this->_assets, array($this, 'sort_assets'));
$output = "\n";
foreach ($this->_assets as $group) {
$styles = Arr::get($group, 'css_files', array());
$scripts = Arr::get($group, 'js_files', array());
// css files
foreach ($styles as $file => $params) {
$wrapper = Arr::get($params, 'wrapper', array('', ''));
$attributes = Arr::get($params, 'attributes', NULL);
$output .= $wrapper[0] . "\n";
$output .= HTML::style($file, $attributes) . "\n";
$output .= $wrapper[1] . "\n";
}
// js files
foreach ($scripts as $file => $params) {
$wrapper = Arr::get($params, 'wrapper', array('', ''));
$attributes = Arr::get($params, 'attributes', NULL);
$output .= $wrapper[0] . "\n";
$output .= HTML::style($file, $attributes) . "\n";
$output .= $wrapper[1] . "\n";
}
}
return $output;
}
示例5: css_assets
protected function css_assets()
{
$current_version = File::get(__DIR__ . "/../../.version");
$basefiles = array('css/main.css', 'css/jquery.jgrowl.css', 'css/ui.jqgrid.css', 'css/fullcalendar.css', 'css/main.css', 'css/jquery.timepicker.css', 'css/jquery.signaturepad.css', 'css/searchFilter.css', 'css/ui.multiselect.css', 'css/chosen.css', 'css/jquery.Jcrop.css', 'css/jquery.realperson.css', 'css/tagit.css', 'css/wColorPicker.min.css', 'css/wPaint.min.css', 'css/jqueryui-editable.css', 'css/timecube.jquery.css', 'css/toastr.min.css');
$image_files = array('chosen-sprite.png', 'chosen-sprite@2x.png', 'Jcrop.gif', 'pen.png');
$response = '';
if (App::isLocal()) {
foreach ($basefiles as $basefile) {
$response .= HTML::style($basefile);
}
} else {
$cssfilename = '/temp/' . $current_version . '.css';
$cssfile = __DIR__ . '/../../public' . $cssfilename;
$str = '';
foreach ($basefiles as $basefile) {
$basefile1 = __DIR__ . '/../../public/' . $basefile;
$str .= File::get($basefile1);
}
foreach ($image_files as $image) {
$new_image = '../css/' . $image;
$str = str_replace($image, $new_image, $str);
}
File::put($cssfile, $str);
$response .= HTML::style($cssfilename);
}
return $response;
}
示例6: style
/**
* Creates a stylesheet link with LESS support
*
* @param string $style file name
* @param array $attributes default attributes
* @param bool $index include the index page
* @param array $imports compare file date for these too, CSS and LESS in style @import
* @return string
*/
public static function style($file, array $attributes = null, $index = false, $imports = null)
{
$imports = (array) $imports;
// Compile only .less files
if (substr_compare($file, '.less', -5, 5, false) === 0) {
$css = substr_replace($file, 'css', -4);
$compiled = is_file($css) ? filemtime($css) : 0;
try {
// Check if imported files have changed
$compile = filemtime($file) > $compiled;
if (!$compile && !empty($imports)) {
foreach ($imports as $import) {
if (filemtime($import) > $compiled) {
$compile = true;
break;
}
}
}
// Compile LESS
if ($compile) {
$compiler = new self($file);
file_put_contents($css, $compiler->parse());
}
$file = $css;
} catch (Exception $e) {
Kohana::$log->add(Kohana::ERROR, __METHOD__ . ': Error compiling LESS file ' . $file . ', ' . $e->getMessage());
}
}
return HTML::style($file . '?' . filemtime($file), $attributes, $index);
}
示例7: add_css_file
public static function add_css_file($filename, $stack, $name, $after = null)
{
//build filename
$filename = 'media/css/' . $filename . '.css';
$script = HTML::style($filename);
self::add_to_stack($script, 'css', $stack, $name, $after);
}
示例8: add
public static function add($url, $attributes = array())
{
if (Str::endsWith($url, '.js')) {
$url .= '?v=' . rand(0, 999);
$asset = \HTML::script($url, $attributes);
$nscript = array('url' => $url, 'html' => $asset);
$am = Session::get('asset_manager_js', array());
foreach ($am as $script) {
if ($url == $script['url']) {
return false;
}
}
$am[] = $nscript;
Session::put('asset_manager_js', $am);
} elseif (Str::endsWith($url, '.css')) {
$url .= '?v=' . rand(0, 999);
$asset = \HTML::style($url, $attributes);
$nstyle = array('url' => $url, 'html' => $asset);
$am = Session::get('asset_manager_css', array());
foreach ($am as $style) {
if ($url == $style['url']) {
return false;
}
}
$am[] = $nstyle;
Session::put('asset_manager_css', $am);
return true;
}
}
示例9: getCSS
function getCSS()
{
// FIXME: this is a hack which will not be needed once
// we have dynamic CSS.
$css = WikiTheme::getCSS();
$css->pushcontent(HTML::style(array('type' => 'text/css'), new RawXml(sprintf("<!--\nbody {background-image: url(%s);}\n-->", $this->getImageURL('uhhbackground.jpg')))));
return $css;
}
示例10: get_css
/**
* Get single CSS asset
*
* @param $handle
* @return bool|string
*/
public static function get_css($handle)
{
if (!isset(self::$_css[$handle])) {
return false;
}
$asset = self::$_css[$handle];
return HTML::style($asset['src'], $asset['attrs']);
}
示例11: style
/**
* 样式别名加载(支持批量加载,后期可拓展为自动多文件压缩合并)
* @return string
*/
function style()
{
$styleArray = array_map(function ($aliases) {
$cssUrl = asset_static($aliases);
return HTML::style($cssUrl);
}, func_get_args());
return implode('', array_filter($styleArray));
}
示例12: get_styles_html
/**
* Gets the default css links for the rte
*
* @return string
*/
public static function get_styles_html()
{
$html = array();
foreach (self::_get_config('styles') as $style) {
$html[] = HTML::style(url::base() . $style);
}
return implode("\n", $html);
}
示例13: styles
public function styles()
{
$result = '';
foreach ($this->styles as $i => $file) {
$result .= \HTML::style($file);
}
return $result;
}
示例14: testGeneratingStyle
/**
* Test generating a link to CSS files
*
* @group laravel
*/
public function testGeneratingStyle()
{
$html1 = HTML::style('foo.css');
$html2 = HTML::style('http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js');
$html3 = HTML::style('foo.css', array('media' => 'print'));
$this->assertEquals('<link href="http://localhost/foo.css" media="all" type="text/css" rel="stylesheet">' . PHP_EOL, $html1);
$this->assertEquals('<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js" media="all" type="text/css" rel="stylesheet">' . PHP_EOL, $html2);
$this->assertEquals('<link href="http://localhost/foo.css" media="print" type="text/css" rel="stylesheet">' . PHP_EOL, $html3);
}
示例15: smarty_function_html_style
/**
* @param array $params
* @param Smarty_Internal_Template $smarty
*
* @throws SmartyException
* @return string
*
* @author Kovács Vince
*/
function smarty_function_html_style($params, Smarty_Internal_Template &$smarty)
{
if (!isset($params['_url'])) {
throw new SmartyException('Missing _url attribute for html_style tag');
}
$url = $params['_url'];
unset($params['_url']);
return HTML::style($url, $params);
}