Skip to content

Instantly share code, notes, and snippets.

@devi
Created February 16, 2011 07:05
Show Gist options
  • Save devi/828977 to your computer and use it in GitHub Desktop.
Save devi/828977 to your computer and use it in GitHub Desktop.
Kohana HTML::style, HTML::script extended
/*
* Extend HTML::style
*
* @param string File name
* @param array Default attributes
* @param string Spesific browser logic/condition
* @param mixed Protocol to pass to URL::base()
* @param boolean Include the index page
* @return string
*/
public static function style($file, array $attributes = NULL, $browser = NULL, $protocol = NULL, $index = FALSE)
{
$style = HTML::style($file,$attributes, $protocol, $index);
if ($browser)
return '<!--[if '.$browser.' ]>'.$style.'<![endif]-->';
return $style;
}
/*
* Extend HTML::script
*
* @param string File name
* @param array Default attributes
* @param string Spesific browser logic/condition
* @param mixed Protocol to pass to URL::base()
* @param boolean Include the index page
* @return string
*/
public static function script($file, array $attributes = NULL, $browser = NULL, $protocol = NULL, $index = FALSE)
{
$script = HTML::script($file, $attributes, $protocol, $index);
if ($browser)
return '<!--[if '.$browser.' ]>'.$script.'<![endif]-->';
return $script;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment