PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Luke Szanto   Tamplate   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: An example of the usage of Tamplate
Class: Tamplate
Template engine that replaces variables with text
Author: By
Last change:
Date: 14 years ago
Size: 637 bytes
 

Contents

Class file image Download
<?php

//Include the class
include "Tamplate.class.php";

//Create a new instance of the class
$tamplate = new Tamplate();

//You can set the variables individually or as an array

//INDIVIDUALLY
//Set the variables
$tamplate->set_var("title", "Example site");
$tamplate->set_var("heading", "The example site");
$tamplate->set_var("message", "Welcome to my example site, I hope you enjoy it");

//AS AN ARRAY
//$tamplate->set_var(array("title" => "Example site", "heading" => "The example site", "mesage" => "Welcome to my example site, I hope you enjoy it"));

//Show the teamplate
$tamplate->show("test.tam");

?>