Lightweight PHP Template Engine
###Usage
- Define data
- Call the create method
- Deploy a template
Using an indexed array
<?php
QuickTemplate::create(array('Toyota', 'Honda', 'Ford'), function() { ?>
<li>%item%</li>
<?php });
Using an associative array
<?php
$state_list = array(
'AL'=>"Alabama",
'AK'=>"Alaska",
'AZ'=>"Arizona",
'AR'=>"Arkansas",
'CA'=>"California",
'CO'=>"Colorado",
'CT'=>"Connecticut" ...
);
QuickTemplate::create($state_list, function() { ?>
<option value="%key%" class="states template %inc%">%value%</option>
<?php }, &$states_content); ?>
Using a two dimensional array
<?php
$data = array(
array(
'title' => 'My test title 1',
'paragraph' => 'Lorem ipusm color dolor.'
),
array(
'title' => 'My test title 2',
'paragraph' => 'just another paragraph',
'date' => 'Jan 3rd, 2014'
)
);
QuickTemplate::create($data, function() { ?>
<!-- my custom template %inc% -->
<div class="template %inc%">
<strong>%title%</strong>
<p>%paragraph%</p>
<span>%date%</span>
</div>
<!-- end -->
<?php }); ?>
###Requirements: PHP 5.4 or greater
dev.jasandpereza.com/quick-template
This is pretty much a beta version. Work may or may not continue. If you have any comments or questions, please email me at jasandpereza@hotmail.com