<?php
include('sTemplate.class.php');
$tpl = new sTemplate;
$tpl->dir = './templates/'; // Use only if you have another directory name - this is default
$tpl->ext = '.html'; // Like dir - use if you have another
$tpl->atr = 'class'; // Like dir and ext - use if you want to use another attribute in html
// Create an array with variables
$data = array(
"title" => "Latest News",
"news" => array(
array(
"header" => "My first news",
"description" => "This is description for my first news"
),
array(
"header" => "Second information of the day",
"description" => "Some text, description, etc."
),
array(
"header" => "My third news",
"description" => "This is description for my 3rd news"
)
)
);
// Show parsed template
$tpl->parse("main", $data);
// Also you can use function load(), like in previous version
$tpl->load("main", $data, true);
// Difference between parse() and load():
// parse() third attribute $show_result = true, in load() it's false
?>
|