Login   Register  
PHP Classes
elePHPant
Icontem

File: examples/example3.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Full name  >  x64Template Engine  >  examples/example3.php  >  Download  
File: examples/example3.php
Role: Example script
Content type: text/plain
Description: Example
Class: x64Template Engine
Template engine extensible with plug-in classes
Author: By
Last change: Changed include paths to reflect folder change
Date: 8 years ago
Size: 1,354 bytes
 

Contents

Class file image Download
<?php

require_once("../x64Template.php");

//
//We start the object
//
$tpl=new x64Template();

$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!")
                                )
);

//
//We set some values
//
$tpl->set("title","x64Template - Third example");
$tpl->set("keywords","x64Template, third example");
$tpl->set("description","x64Template - third example showing how to use multi-dimensional arrays");
$tpl->set("author","Atomo64");
$tpl->set("robots","None");
$tpl->set("message","Hi there!, why don't you take a look at the products I have?, I have many categories");

//
//And we can set a loop (array) the same way as we set a normal variable
//
$tpl->set("products",$products);

//
//Now we tell the class to parse a file
//

die($tpl->fetch("templates/example3.tpl"));
?>