Created
June 8, 2010 13:56
-
-
Save John2496/430038 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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