banksy89 / Mini-Templater

This is a little templating class I am creating, that handles Foreach loops within the views - so no PHP is inside views whatsoever. Then I can plug it into the Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The Template Class


Brief:

This is the templating class I have been working on and had working practise with in a few recent project - it's no where near perfect but doing the job so far.

The templating is based on [ ] brackets - although I am looking to move them too something less generic like {% %}

Setting up tags to replace just set an array for example: $tags and call each key the tag you want to replace -> $tags['name'] = 'Ashley'


Example usage:

Standard Tags

[BANANA]

Conditional Tags

conditional statements are reliant on whether the variable is set to TRUE.

[IF SHOW_BANANA]

I am only shown if show_banana is true

[/ENDIF SHOW_BANANA]

Foreach Tags

Foreach loops are based on associative arrays within an array ( two dimensional ).
Example: array ( array ( 'name' => 'Ashley Banks' ), array ( 'name' => 'Banana man' ) )

[FOREACH banana as b]

My name is: [b.name]

[/banana FOREACH]

About

This is a little templating class I am creating, that handles Foreach loops within the views - so no PHP is inside views whatsoever. Then I can plug it into the Framework


Languages

Language:PHP 100.0%