Revision: 17276
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 30, 2009 12:35 by antpaw
Initial Code
<?php defined('SYSPATH') or die('No direct script access.'); class html extends html_Core { public static function lianchor(array $links, $curr_check = NULL, $li_active_class = NULL, $a_active_class = NULL) { $output = null; foreach($links as $link => $name) { $li_class = null; $a_class = null; if($link == $curr_check) { if($li_active_class != NULL) $li_class = array('class' => $li_active_class); if($a_active_class != NULL) $a_class = array('class' => $a_active_class); } $output .= '<li'.parent::attributes($li_class).'>'.parent::anchor($link, $name, $a_class).'</li>'."\n"; } return $output; } public static function script($script, $index = FALSE) { $compiled = ''; if (is_array($script)) { foreach ($script as $name) { $compiled .= html::script($name, $index); } } else { if (strpos($script, '://') === FALSE) { // Add the suffix only when it's not already present $script = url::base((bool) $index).$script; } if (substr_compare($script, '.js', -3, 3, FALSE) !== 0 && substr_compare($script, '/', -1, 1, FALSE) !== 0) { // Add the javascript suffix $script .= '.js'; } $compiled = '<script type="text/javascript" src="'.$script.'"></script>'; } return $compiled."\n"; } public static function image($src = NULL, $alt = NULL, $index = FALSE) { // Create attribute list $attributes = is_array($src) ? $src : array('src' => $src); if (is_array($alt)) { $attributes += $alt; } elseif ( ! empty($alt)) { // Add alt to attributes $attributes['alt'] = $alt; } else { $attributes['alt'] = ''; } if (strpos($attributes['src'], '://') === FALSE) { // Make the src attribute into an absolute URL $attributes['src'] = url::base($index).$attributes['src']; } return '<img'.html::attributes($attributes).' />'; } }
Initial URL
Initial Description
My Kohana HTML Helper
Initial Title
Extended Kohana HTML Helper
Initial Tags
php, xhtml
Initial Language
PHP