Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

script html helper

Derek Jones edited this page · 2 revisions
Clone this wiki locally

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.

Something went wrong with that request. Please try again.