PHP Classes

File: usage.php

Recommend this page to a friend!
  Classes of Rupom Razzaque   Simple Template Parser Class   usage.php   Download  
File: usage.php
Role: Example script
Content type: text/plain
Description: Use of Simple Template Parser Class
Class: Simple Template Parser Class
Regular expression matching based template engine
Author: By
Last change:
Date: 18 years ago
Size: 974 bytes
 

Contents

Class file image Download
<?php
/**
* Usage of Simple TemplateParser Class
*
* @author : MA Razzaque Rupom <rupom_315@yahoo.com>, <rupom.bd@gmail.com>
* Moderator, phpResource (http://groups.yahoo.com/group/phpresource/)
* URL: http://www.rupom.info
* @version : 1.0
* Purpose : Parsing Simple Template File and Data that Contains Macros
*/

require_once "TemplateParser.class.php";
$data = array();
$data['first_name'] = "MA";
$data['last_name'] = "Razzaque";
$data['nick_name'] = "Rupom";
$data['password'] = "supersecret";
$data['sender_name'] = "Administrator";
$data['site_name'] = "Name_Of_Site";

$obj = new TemplateParser();
$obj->initData($data);

//Parse Template File
$parsedData = $obj->parseTemplateFile("template.html");
echo
$parsedData;

echo
"<br>-----------------------------------<br>";

//Parse Template Data
$parsedData = $obj->parseTemplateData(file_get_contents("template.html"));
echo
$parsedData;

?>