If you’re going to go as far as a helper for header tags (h1, h2, h3) or even link tags why not script tags too?
Plop this into your html_helper.php file in the system/helpers folder or copy your html_helper.php file, place it in your application/helpers folder and then plop this code in. This way, if and when you update codeigniter to the latest version, this code won’t be overwritten and lost.
//————————————————————————————————————
/**
* Script
*
* Generates an HTML script tag for importing an external javascript file.
*
* @access public
* @param string
* @return string
*/
if ( ! function_exists(‘script’))
{
function script($rpath)
{
return ‘<script src=”’.base_url().$rpath.’” type=“text/javascript”></script>’;
}
}
//————————————————————————————————————
Please not that base_url() requires the url helper. You should probably have that on autoload anyway.
