Creates a style sheet link element.
echo HTML::style('media/css/screen.css');
string Core_HTML::style( string $file [, array $attributes = null , boolean $index = bool false ] )
参数列表
参数 类型 描述 默认值 $file
string
File name $attributes
array
Default attributes null $index
boolean
Include the index page bool false
string
public static function style($file, array $attributes = null, $index = false)
{
if (strpos($file, '://') === false)
{
// Add the base URL
$file = Core::url()->base($index) . $file;
}
// Set the stylesheet link
$attributes['href'] = $file;
// Set the stylesheet rel
$attributes['rel'] = 'stylesheet';
// Set the stylesheet type
$attributes['type'] = 'text/css';
return '<link' . HTML::attributes($attributes) . ' />';
}