PHP Classes

File: examples/user.php

Recommend this page to a friend!
  Classes of Michael Orji   Simplate   examples/user.php   Download  
File: examples/user.php
Role: Example script
Content type: text/plain
Description: example usage
Class: Simplate
Template engine that replaces arrays of variables
Author: By
Last change:
Date: 9 years ago
Size: 737 bytes
 

Contents

Class file image Download
<?php

include('../simplate.class.php');
   
/**
* Creates a new template for the user's profile.
* Fills it with mockup data just for testing.
*/
$user_tpl = new Simplate('templates/', 'user_profile.tpl');
$user_tpl->username = 'KingSlayer';
$user_tpl->image_url = 'images/koala.jpg';
$user_tpl->firstname = 'Jamie';
$user_tpl->lastname = 'Lanister';
$user_tpl->email = 'kslayer@thelanisters.com';
   
   
/**
* Loads our layout template, settings its title and content.
*/
$main_tpl = new Simplate('templates/', 'layout.tpl');
$main_tpl->title = $user_tpl->username. '\'s profile';
$main_tpl->content = $user_tpl->parse();
   
/**
* Outputs the page with the user's profile.
*/
echo $main_tpl->parse();
   
?>