<?php
include('../simplate.class.php');
/**
* Creates a new template for the user's profile.
* Fills it with mockup data just for testing.
*/
$data = array('username'=>'Kingslayer', 'image_url'=>'images/koala.jpg', 'firstname'=>'Jamie', 'lastname'=>'Lanister', 'email'=>'kslayer@thelanisters.com');
$user_tpl = new Simplate('templates/', 'user_profile_loop.tpl');
$user_tpl->user_data = $data;
/**
* Loads our layout template, settings its title and content.
*/
$main_tpl = new Simplate('templates/', 'layout.tpl');
$main_tpl->content = $user_tpl->parse();
/**
* In this case, set the title after the call to the parse() method
* This is because the properties of the $user_tpl object will
* only be created after the parse() method has been called to set the member properties of the Simplate Instance
* from the members of the data array
*
* If title or any other property (apart from the data associative array) is set before the call to parst(), you will get an empty string
*/
$main_tpl->title = $user_tpl->username. '\'s profile';
/**
* Outputs the page with the user's profile.
*/
echo $main_tpl->parse();
?>
|