HTML(html) Sample

<?php
/**
 * Html helper
 *
 * Created on 2011. 11. 18.
 * @author 불의회상 <hoksi2k@hanmail.net>
 * @package helper
 * @subpackage controllers
 * @version 1.0
 */
class Html_hlp extends CI_Controller {
	function __construct()
	{
		parent::__construct();
		
		// File Helper Load
		$this->load->helper('html');
	}
	
	function index() {
		// br()
		$data['br'] = br(3);
		
		// heading()
		$data['heading_default'] = heading('Welcome!');
		$data['heading_3'] = heading('Welcome!', 3);
		$data['heading_class'] = heading('Welcome!', 3, 'class="pink"');
		
		// img()
		$img_attr = array(
			'src' => 'images/picture.jpg',
			'alt' => 'Pizza at one time',
			'class' => 'post_images',
			'width' => '200',
			'height' => '200',
			'title' => 'That was quite a night',
			'rel' => 'lightbox'
		);
		$data['img_default'] = img('images/picture.jpg');
		$data['img_index'] = img('images/picture.jpg', TRUE);
		$data['img_attr'] = img($img_attr);
		
		// link_tag()
		$link_attr = array(
			'href' => 'css/printer.css',
			'rel' => 'stylesheet',
			'type' => 'text/css',
			'media' => 'print'
		);
		$data['link_deafult'] = link_tag('css/mystyles.css');
		$data['link_ico'] = link_tag('favicon.ico', 'shortcut icon', 'image/ico');
		$data['link_feed'] = link_tag('feed', 'alternate', 'application/rss+xml', 'My RSS Feed');
		$data['link_attr'] = link_tag($link_attr);
		
		// nbs()
		$data['nbs'] = nbs(3);
		
		// ul() or ol()
		$list = array(
			'colors' => array(
				'red',
				'blue',
				'green'
			),
			'shapes' => array(
				'round', 
				'square',
				'circles' => array(
					'ellipse', 
					'oval', 
					'sphere'
				)
			),
			'moods'    => array(
				'happy', 
				'upset' => array(
					'defeated' => array(
						'dejected',
						'disheartened',
						'depressed'
					),
					'annoyed',
					'cross',
					'angry'
				)
			)
		);
		$data['ul'] = ul($list);
		
		// meta()
		$meta = array(
			array('name' => 'robots', 'content' => 'no-cache'),
			array('name' => 'description', 'content' => 'My Great Site'),
			array('name' => 'keywords', 'content' => 'love, passion, intrigue, deception'),
			array('name' => 'robots', 'content' => 'no-cache'),
			array('name' => 'Content-type', 'content' => 'text/html; charset=utf-8', 'type' => 'equiv')
		);
		
		$data['meta_default'] = meta('description', 'My Great site');
		$data['meta_array'] = meta($meta);
		
		$this->load->view('html_hlp_sample', $data);
	}
}
<?php $this->load->view('inc/header')?>

<table class="tablesorter" border="0" cellpadding="0" cellspacing="1">
<thead>
<tr>
  <th style="text-align:center" width="20%">구분</th>
  <th width="80%">결과</th>
</tr>
</thead>
<tr>
	<td>br(3)</td>
	<td><xmp><?php echo $br?></xmp></td>
</tr>
<tr>
	<td>nbs(3)</td>
	<td><xmp><?php echo $nbs?></xmp></td>
</tr>
<tr>
	<td>heading('Welcome!')</td>
	<td><xmp><?php echo $heading_default?></xmp></td>
</tr>
<tr>
	<td>heading('Welcome!', 3)</td>
	<td><xmp><?php echo $heading_3?></xmp></td>
</tr>
<tr>
	<td>heading('Welcome!', 3, 'class="pink"')</td>
	<td><xmp><?php echo $heading_class?></xmp></td>
</tr>
<tr>
	<td>img('images/picture.jpg')</td>
	<td><xmp><?php echo $img_default?></xmp></td>
</tr>
<tr>
	<td>img('images/picture.jpg', TRUE)</td>
	<td><xmp><?php echo $img_index?></xmp></td>
</tr>
<tr>
	<td>img($img_attr)</td>
	<td><xmp><?php echo $img_attr?></xmp></td>
</tr>
<tr>
	<td>link_tag('css/mystyles.css')</td>
	<td><xmp><?php echo $link_deafult?></xmp></td>
</tr>
<tr>
	<td>link_tag('favicon.ico', 'shortcut icon', 'image/ico')</td>
	<td><xmp><?php echo $link_ico?></xmp></td>
</tr>
<tr>
	<td>link_tag('feed', 'alternate', 'application/rss+xml', 'My RSS Feed')</td>
	<td><xmp><?php echo $link_feed?></xmp></td>
</tr>
<tr>
	<td>link_tag($link_attr)</td>
	<td><xmp><?php echo $link_attr?></xmp></td>
</tr>
<tr>
	<td>meta('description', 'My Great site')</td>
	<td><xmp><?php echo $meta_default?></xmp></td>
</tr>
<tr>
	<td>meta($meta)</td>
	<td><xmp><?php echo $meta_array?></xmp></td>
</tr>
<tr>
	<td>ul($list)</td>
	<td><xmp><?php echo $ul?></xmp></td>
</tr>
</table>

<?php $this->load->view('inc/footer')?>

© Copyright by hoksi(Page rendered in 0.0091 seconds)