PHP Classes

File: examples/example2.php

Recommend this page to a friend!
  Classes of Full name   x64Template Engine   examples/example2.php   Download  
File: examples/example2.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: 18 years ago
Size: 870 bytes
 

Contents

Class file image Download
<?php

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

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

$products[]=array("name"=>"Orange","price"=>"2");
$products[]=array("name"=>"Apple","price"=>"1.5");
$products[]=array("name"=>"Melon","price"=>"5");
$products[]=array("name"=>"Water Melon","price"=>"4.9");

//
//We set some values
//
$tpl->set("title","x64Template - Second example");
$tpl->set("keywords","x64Template, second example");
$tpl->set("description","x64Template - second example showing how to use 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?");

//
//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/example2.tpl"));
?>