All pastes #945327 Raw Edit

CI - HTML_helper - Link_tag

public php v1 · immutable
·published 2008-03-16 21:03 UTC
rendered paste body
// ------------------------------------------------------------------------/** * Link * * Generates link to a CSS file * * @access	public * @param	mixed	stylesheet hrefs or an array * @param	string	rel * @param	string	type * @param	string	title * @param	string	media * @param	boolean	should index_page be added to the css path  * @return	string */	if (! function_exists('link_tag')){	function link_tag($href = '', $rel = 'stylesheet', $type = 'text/css', $title = '', $media = '', $index_page = FALSE)	{		$CI =& get_instance();		$link = '<link ';		if (is_array($href))		{			foreach ($href as $k=>$v)			{				if ($k == 'href' AND strpos($k, '://') === FALSE)				{					if ($index_page === TRUE)					{						$link .= ' href="'.$CI->config->site_url($v).'" ';					}					else					{						$link .= ' href="'.$CI->config->slash_item('base_url').$v.'" ';					}				}				else				{					$link .= "$k=\"$v\" ";				}			}						$link .= "/>\n";		}		else		{			if ( strpos($href, '://') !== FALSE)			{				$link .= ' href="'.$href.'" ';			}			elseif ($index_page === TRUE)			{				$link .= ' href="'.$CI->config->site_url($href).'" ';			}			else			{				$link .= ' href="'.$CI->config->slash_item('base_url').$href.'" ';			}							$link .= 'rel="'.$rel.'" type="'.$type.'" ';						if ($media	!= '')			{				$link .= 'media="'.$media.'" ';			}			if ($title	!= '')			{				$link .= 'title="'.$title.'" ';			}						$link .= '/>'."\n";		}			return $link;	}}