<?php /** * Text helper * * Created on 2011. 11. 18. * @author 불의회상 <hoksi2k@hanmail.net> * @package helper * @subpackage controllers * @version 1.0 */ class Text_hlp extends CI_Controller { function __construct() { parent::__construct(); $this->load->helper('text'); } function index() { $string = "100송이의 무궁화 꽃이 피었습니다. (Quick brown fox jumps over the lazy dog.)"; $data['str'] = $string; $data['word_limiter'] = word_limiter($string, 5); $data['character_limiter'] = character_limiter($string, 30); $data['ascii_to_entities'] = ascii_to_entities($string); $data['convert_accented_characters'] = convert_accented_characters($string); $data['word_censor'] = word_censor($string, array('꽃이', 'fox')); $data['highlight_code'] = highlight_code($string); $data['highlight_phrase'] = highlight_phrase($string, "무궁화", '<span style="color:#990000">', '</span>'); $data['word_wrap'] = word_wrap($string, 20); $data['ellipsize'] = ellipsize($string, 32, .5); $this->load->view('text_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> <th style="text-align:center" width="20%">예문</th> <th width="80%"><?php echo $str?></th> </tr> <tr> <td>word_limiter($string, 5)</td> <td><?php echo $word_limiter?></td> </tr> <tr> <td>character_limiter($string, 30)</td> <td><?php echo $character_limiter?></td> </tr> <tr> <td>ascii_to_entities($string)</td> <td><xmp><?php echo $ascii_to_entities?></xmp><?php echo $ascii_to_entities?></td> </tr> <tr> <td>convert_accented_characters($string)</td> <td><?php echo $convert_accented_characters?></td> </tr> <tr> <td>word_censor($string, array('꽃이', 'fox'))</td> <td><?php echo $word_censor?></td> </tr> <tr> <td>highlight_code($string)</td> <td><?php echo $highlight_code?></td> </tr> <tr> <td>highlight_phrase($string, "무궁화", '<span style="color:#990000">', '</span>')</td> <td><?php echo $highlight_phrase?></td> </tr> <tr> <td>word_wrap($string, 20)</td> <td><?php echo $word_wrap?></td> </tr> <tr> <td>ellipsize($string, 32, .5)</td> <td><?php echo $ellipsize?></td> </tr> </table> <?php $this->load->view('inc/footer')?>
© Copyright by hoksi(Page rendered in 0.0063 seconds)