Skip to content

Parser Variable Modifiers

World Wide Web Server edited this page Jul 4, 2012 · 14 revisions

Category:Library::Community | Category:Library::Template Parser [h3]Introduction[/h3] CI_Parser extension that implements Smarty variable modifiers. [h3]Download[/h3] File:VariableModifiers-v0.2.zip [h3]Usage[/h3] Used almost exactly the way [url=http://www.smarty.net/manual/en/language.modifiers.php]Smarty variable modifiers[/url] are used.

[b]Exceptions[/b] Strings do not need quotes.

[b]Not implemented[/b] default indent regex_replace wordwrap

See the comments at the top of the file for more info.

[h3]Example:[/h3] Controller: [code]class Test extends Controller {

function Test()
{
    parent::Controller();    
}

function index()
{
    $this->load->library('parser');
    
    $data['alink'] = "<a href='www.google.com'>would've GONE to google</a>";
    $data['adate'] = strtotime("12/30/2002");
    
    $this->parser->parse('test', $data);
}

}[/code]

Template(view): [quote]Today is {adate|date_format} and this link is no more... {alink|strip_tags|lower}.[/quote]

Will display: [quote]Today is Dec 30, 2002 and this link is no more... would've gone to google.[/quote]

Clone this wiki locally