PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Marko Schulz   Tmpl   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: This is only an example PHP file.
Class: Tmpl
Template engine that replaces placeholders
Author: By
Last change:
Date: 15 years ago
Size: 379 bytes


Class file image Download

include_once( 'tmpl.class.php' );

// Create Tmpl Object.
(object) $tpl = new Tmpl( array( 'file' => 'example.tpl' ) );

// Parse and print out the template.
$tpl->replace( '[%TITLE%]', 'My Site' );
$tpl->replace( '[%BGCOLOR%]', '#f5f5f5' );
$tpl->replace( '[%COLOR%]', '#003366' );
$tpl->replace( '[%FONT%]', 'Verdana, Helvetica, Sans-Serif' );