Creates a script link.
echo HTML::script('media/js/jquery.min.js');
string Core_HTML::script( 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 script($file, array $attributes = null, $index = false)
{
if (strpos($file, '://') === false)
{
// Add the base URL
$file = Core::url()->base($index) . $file;
}
// Set the script link
$attributes['src'] = $file;
// Set the script type
$attributes['type'] = 'text/javascript';
return '<script' . HTML::attributes($attributes) . '></script>';
}