PHP Classes

File: examples/example5.php

Recommend this page to a friend!
  Classes of Full name   x64Template Engine   examples/example5.php   Download  
File: examples/example5.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: 851 bytes
 

Contents

Class file image Download
<?php

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

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

//
//We set some values
//
$tpl->set("title","x64Template - Plugins example");
$tpl->set("keywords","x64Template, plugins example");
$tpl->set("description","x64Template - example using a simple PHP code highlighter plugin");
$tpl->set("author","Atomo64");
$tpl->set("robots","None");
$tpl->set("[PHP_SELF]",$_SERVER['PHP_SELF']);

//
//If the user sent some PHP code then we add it
// note that the third param tells the engine to look up for 'if' tags
//
$tpl->set("code",(isset($_POST['code']))? htmlentities($_POST['code']) : '',true);

//
//And now we add the plugin
//
$tpl->add_plugin("php_code_plugin");

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

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