Login   Register  
PHP Classes

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Archzilon Eshun-Davies  >  cTemplate  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script of how to use cTemplate.php
Class: cTemplate
Template engine based on string replacement
Author: By
Last change: Fixed a typo with the template from string. Thanks to Darren Conyard for noticing this
Date: 1 year ago
Size: 651 bytes


Class file image Download
     * This is the example script of how to use cTemplate.php
     * this has two exapmles, one is to show how to make a templte
     * from string and the second is to show how to use a template file

$tpl = new cTemplate();
# String Template
$templatestring "Hello {NAME}, You have {NUMBERMAILS} new messages";
# Template in a file
$templatefile "dashboard.tpl";


# show template from string
print $tpl->gettpl($templatestring);

# show template from file
print $tpl->gettpl_file($templatefile);