CodeIgniter Forums

Full Version: Extended Template Parser Library
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]GDmac - expocom[/eluser]
The CodeIgniter Template Parser Class enables you to parse pseudo-variables contained within your view files. It can parse simple variables or variable tag pairs, like {username} - {items} {title} {/items}
http://ellislab.com/codeigniter/user-gui...arser.html

Over time several forum users added functionality. Next to parsing a view it also parses strings. After combining these functionalities and tweeking it further it is now a handy class to let users for instance edit an email template or a partial view.

adamp1 added removal of unused tags, isaiahdw added {if} {else} conditionals, rafsoaken added various updates and array parsing {array key} and i took it from the attic, adding nested conditionals and {ignore} tags for text that shouldn't be parsed.
http://ellislab.com/forums/viewthread/68878/P45/#744970

Some feedback and testing would be appreciated.

[pre] * Library: Extended Parser Class (2008-2010)
* Features: Parse templates, loaded as a view, and/or parse strings;
* Nested simple conditionals {if *}x{else}y{/if}.
* Array-element access; Successive same array usage;
* - Use Parse() to load a standard view with the php being processed.
* Parse_string() allows you, for instance, to build an email-message
* with simple template logic, or a partial view.
*
* Discuss: http://ellislab.com/forums/viewthread/68878/P45/
*
[/pre]