TIPS in including your DOCUMENT TYPE, FAVICON, META, CSS, JAVASCRIPT, in your web page. |
[eluser]rm_beginner[/eluser]
In reviewing the core and some libraries... I want to share some of my modification made in "HTML helpers" and /application/config/doctypes.php. NOTE: make sure you have css and js folder in your base_url() apply only in your VIEW files.. #USAGE OF YOUR DOCUMENT HEADING without CONSTANT VALUE: <?php echo doctype('xhtml1-frame-xmlns'); ?> <head> <?php echo meta('Content-type', 'text/html; charset=utf-8', 'equiv'); echo link_tag('favicon.ico', 'icon', 'image/x-icon'); echo link_tag('css/login.css'); echo link_java('js/jquery-1.5.2.min.js'); ?> <title>MY LOGIN <?php echo lang('login_now'); ?></title> </head> OUTPUT IN YOUR "VIEW" FILE: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html > <head> <meta http-equiv="Content-type" c charset=utf-8" /> <link href="http://localhost/favicon.ico" rel="icon" type="image/x-icon" /> <link href="http://localhost/css/login.css" rel="stylesheet" type="text/css" /> [removed][removed] <title>MY LOGIN .. </title> </head> #USAGE OF YOUR DOCUMENT HEADING WITH CONSTANT VALUE e.g. APPLICATION VERSION <?php echo doctype('xhtml1-frame-xmlns'); ?> <head> <?php echo meta('Content-type', 'text/html; charset=utf-8', 'equiv'); echo link_tag('favicon.ico', 'icon', 'image/x-icon'); echo link_tag('css/login.css?.'.APPLICATION_VERSION); echo link_java('js/jquery-1.5.2.min.js?'.APPLICATION_VERSION); ?> <title>MY LOGIN <?php echo lang('login_now'); ?></title> </head> OUTPUT IN YOUR "VIEW" FILE: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html > <head> <meta http-equiv="Content-type" c charset=utf-8" /> <link href="http://localhost/favicon.ico" rel="icon" type="image/x-icon" /> <link href="http://localhost/css/login.css?.1.0" rel="stylesheet" type="text/css" /> [removed][removed] <title>MY LOGIN .. </title> </head> MODIFICATION #1: In system/helpers/html_helper.php add this to include JAVASCRIPT FILE in your PAGE. // ------------------------------------------------------------------------ /** * Link * * Generates link to a JAVASCRIPT file * * @access public * @param mixed stylesheet hrefs or an array * @param string type * @param string language * @param string charset * @param boolean should index_page be added to the javascript path * @return string * Author: [email protected] */ if ( ! function_exists('link_java')) { function link_java($href = '', $type = 'text/javascript', $language = 'javascript', $charset = 'UTF-8', $index_page = FALSE) { $CI =& get_instance(); $link = '[removed]$v) { if ($k == 'src' AND strpos($v, '://') === FALSE) { if ($index_page === TRUE) { $link .= 'src="'.$CI->config->site_url($v).'" '; } else { $link .= 'src="'.$CI->config->slash_item('base_url').$v.'" '; } } else { $link .= "$k=\"$v\" "; } } $link .= '>[removed]'."\n"; //arman put enter } else { if ( strpos($href, '://') !== FALSE) { $link .= 'src="'.$href.'" '; } elseif ($index_page === TRUE) { $link .= 'src="'.$CI->config->site_url($href).'" '; } else { $link .= 'src="'.$CI->config->slash_item('base_url').$href.'" '; } $link .= 'type="'.$type.'" '; if ($charset != '') { $link .= 'charset="'.$charset.'" '; } if ($language != '') { $link .= 'language="'.$language.'"'; } $link .= '>[removed]'."\n"; //arman put enter } return $link; } } MODIFICATION #2: insert this array element in /config/doctype.php 'xhtml1-frame-xmlns' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">'."\n".'<html >'."\n\r", You can autoload your helper in /application/config/autoload.php $autoload['helper'] = array('html') |
Welcome Guest, Not a member yet? Register Sign In |