Skip to content

Instantly share code, notes, and snippets.

@John2496
Created June 8, 2010 13:56
Show Gist options
  • Save John2496/430038 to your computer and use it in GitHub Desktop.
Save John2496/430038 to your computer and use it in GitHub Desktop.
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Html head helper methods
*
* @package Layout Module
* @author John Himmelman ([email protected])
*/
class Head
{
protected static $stylesheets = array();
protected static $scripts = array();
public static function get_scripts()
{
$ret = '';
foreach (self::$scripts as $file)
{
$ret .= html::script($file) . "\n";
}
return $ret;
}
public static function get_stylesheets()
{
$ret = '';
foreach (self::$stylesheets as $file)
{
$ret .= html::style($file) . "\n";
}
return $ret;
}
public static function include_scripts()
{
echo self::get_scripts();
}
public static function include_stylesheets()
{
echo self::get_stylesheets();
}
public static function add_javascript($file)
{
self::$scripts[] = $file;
}
public static function add_stylesheet($file)
{
self::$stylesheets[] = $file;
}
public static function javascript($file)
{
return self::add_javascript($file);
}
public static function stylesheet($file)
{
return self::add_stylesheet($file);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment