PHP Classes

File: test_06_smarty.php

Recommend this page to a friend!
  Classes of n/a   Cache output and objects   test_06_smarty.php   Download  
File: test_06_smarty.php
Role: Example script
Content type: text/plain
Description: Smarty plugin example
Class: Cache output and objects
Cache the output of PHP scripts in files
Author: By
Last change:
Date: 17 years ago
Size: 624 bytes
 

Contents

Class file image Download
<?php
define
('SMARTY_DIR', 'smarty/smarty/');
if(!
file_exists(SMARTY_DIR.'Smarty.class.php'))
   
trigger_error("You need Smarty for this example!", E_USER_ERROR);
require(
SMARTY_DIR . 'Smarty.class.php');
$smarty = new Smarty;

require_once(
"cache.php");
require_once(
"smarty/block.cache.php");

$cache = new Cache(".");
$smarty->cache = &$cache;
$smarty->register_block("cache","smarty_block_cache");

$smarty->template_dir = 'smarty';
$smarty->compile_dir = 'smarty';
$smarty->config_dir = 'smarty';
$smarty->cache_dir = 'smarty';

$smarty->assign('date',date("H:i:s"));

$smarty->display('test_06_smarty.tpl');

?>