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


PHP HTML::style方法代码示例

本文整理汇总了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&amp;f=<?php 
echo implode(",", self::$_styles);
?>
' /><?

                 break;                        
          } 
          
    }
开发者ID:kippel,项目名称:kippel-util,代码行数:34,代码来源:media.php

示例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));
 }
开发者ID:aliyubash23,项目名称:SwiftRiver,代码行数:7,代码来源:Welcome.php

示例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));
     }
 }
开发者ID:romartyn,项目名称:cogear,代码行数:12,代码来源:Harvester.php

示例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;
 }
开发者ID:Zeelot,项目名称:yuriko_cms,代码行数:29,代码来源:assets.php

示例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;
 }
开发者ID:kylenave,项目名称:nosh-core,代码行数:27,代码来源:BaseController.php

示例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);
 }
开发者ID:netbiel,项目名称:core,代码行数:39,代码来源:less.php

示例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);
 }
开发者ID:jonlb,项目名称:JxCMS,代码行数:7,代码来源:assets.php

示例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;
     }
 }
开发者ID:JorgeVasquezRetamal,项目名称:Personal,代码行数:29,代码来源:Asset.php

示例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;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:8,代码来源:themeinfo.php

示例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']);
 }
开发者ID:NegoCore,项目名称:core,代码行数:14,代码来源:Assets.php

示例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));
 }
开发者ID:hewangxu,项目名称:hmevent,代码行数:12,代码来源:Base.func.php

示例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);
 }
开发者ID:JDStraughan,项目名称:kohana-lwrte,代码行数:13,代码来源:lwrte.php

示例13: styles

 public function styles()
 {
     $result = '';
     foreach ($this->styles as $i => $file) {
         $result .= \HTML::style($file);
     }
     return $result;
 }
开发者ID:binaryk,项目名称:terenuripedia,代码行数:8,代码来源:Treeview.php

示例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);
 }
开发者ID:gigikiri,项目名称:masjid-l3,代码行数:14,代码来源:html.test.php

示例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);
}
开发者ID:vi-kon,项目名称:laravel-smarty-view,代码行数:18,代码来源:function.html_style.php


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