<?php 
 
require_once("../x64Template.php"); 
 
// 
//We start the object 
// 
$tpl=new x64Template(); 
 
// 
//If you want to test this example... you can give an empty() value to the products key 
// or just set the $products to any empty() value 
// 
$products[]=array("name"=>"Fruits", 
                "description"=>"Eat healthy food!", 
                "products"=>array( 
                                    array("name"=>"Orange","price"=>"2"), 
                                    array("name"=>"Apple","price"=>"1.5"), 
                                    array("name"=>"Melon","price"=>"5"), 
                                    array("name"=>"Water Melon","price"=>"4.9") 
                                ) 
); 
$products[]=array("name"=>"Operating Systems", 
                "description"=>"Check out these good OS's!", 
                "products"=>array( 
                                    array("name"=>"Debian GNU/Linux","price"=>"Free!"), 
                                    array("name"=>"Fedora","price"=>"Free!"), 
                                    array("name"=>"Ubuntu","price"=>"Free!"), 
                                    array("name"=>"Knoppix","price"=>"Free!") 
                                ) 
); 
$products[]=array("name"=>"PCs", 
                "description"=>"The best PCs!", 
                "products"=>false 
); 
 
// 
//We set some values 
// 
$tpl->set("title","x64Template - Using ifs"); 
$tpl->set("keywords","x64Template, ifs example, ifs in loops"); 
$tpl->set("description","x64Template - some more blablablabla"); 
$tpl->set("author","Atomo64"); 
$tpl->set("robots","None"); 
$tpl->set("message","Hello there, we don't have all our products at the moment"); 
 
// 
//And we can set a loop (array) the same way as we set a normal variable 
// 
//In order to activate the if system for loops you have to give an array containing the tags 
//which you want to be enabled for the 'ifs'. 
// 
$tpl->set("products",$products,array("products"=>true)); 
 
// 
//Now we tell the class to parse a file 
// 
 
die($tpl->fetch("templates/example4.tpl")); 
?>
 
 |