Skip to content

Parser Variable Modifiers

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

Category:Template Parser

CI_Parser extension that implements Smarty variable modifiers.

[size=4][b]Usage[/b][/size] 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.

[size=3][b]Example:[/b][/size] 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]

Download: File:VariableModifiers-v0.2.zip

Clone this wiki locally