Skip to content

Parser Variable Modifiers

Derek Jones edited this page Jul 5, 2012 · 14 revisions

Category:Library::Community | Category:Library::Template Engine

Introduction

CI_Parser extension that implements Smarty variable modifiers.

Download

File:VariableModifiers-v0.2.zip

Usage

Used almost exactly the way Smarty variable modifiers are used.

Exceptions Strings do not need quotes.

Not implemented default indent regex_replace wordwrap

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

Example:

Controller:

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);
    }
}

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