Download the PHP package gccloud/parser without Composer
On this page you can find all versions of the php package gccloud/parser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gccloud/parser
More information about gccloud/parser
Files in gccloud/parser
Package parser
Short Description CodeIgniter 3 Parser library extension
License Apache-2.0
Homepage https://github.com/gccloud/parser
Informations about the package parser
CodeIgniter Parser
CI Parser Library extension (empty tags replacement, extended loops, conditional IF and SWITCH structures, CI Helper calls)
Initial Note
To see how to load, initialize and use standard methods of the CI Parser Library, see Template Parser Class Documentation
Installation by Composer
Option 1 : Run composer
Option 2 : or edit /composer.json
And then run composer update
Basic Changes
- While parsing a view, all tags found that does not match any data variable will be replaced with an empty string
- The Parser will automatically parse any variable loaded in CI via the Loader Class
Advanced Examples
Declaring conditional blocks
Conditional IF
{if {variable} condition value}
block to output if condition is TRUE
{/if}
OR
{if {variable} condition value}
block to output if condition is TRUE
{else}
block to output if condition returns FALSE
{/if}
the condition tag may take any value among ==, !=, <>, <, <=, > or >=
Conditional SWITCH
{switch {variable}}
{case first_value}
block to output if the first case matches expected value
{break}
{case second_value}
block to output if the second case matches expected value
{break}
{default}
default block to output
{break}
{/switch}
Declaring loops
{for index from start_value to end_value step step_value}
output block to loop on with the {index} displayed at each step
{/for}
Viewing indexes in an array structure
{array_name}
{index in array_name}
{/array_name}
Calling a Helper in a view
{helper_name([argument_1 [, argument_2 ...]])}
For example :
will be equivalent to :
Note that, though arguments are passed to Helpers as strings, they don't require surrounding simple or double quotes when called via the Parser.
Helper calls can also be nested. For example :
will be equivalent to :