Demo: cache, Cache a static parsed file

Welcome to Demo: cache, Cache a static parsed file

This is a cached file

Footer


The End
Control

										
										
include_once( 'includes/pTemplate.php' );

$pTemplate->add_file( 'templates/cache_static_file.html' );
$output = $pTemplate->pparse_file( 'templates/cache_static_file.html' );
 
// cache footer file
$pTemplate->cache( 'cache_static_file.html', $pTemplate::PCACHE_SET, $output );
 
echo $output;
exit;
										
// GET a cached content
include_once( 'includes/pTemplate.php' );

$footer = $pTemplate->cache( 'cache_static_file.html' );

if( empty($footer) ) {
	$pTemplate->add_file( 'templates/cache_static_file.html' );
	$footer = $pTemplate->pparse_file( 'templates/cache_static_file.html' );
}
 
echo $footer;
exit;

Other demos

View Online Documentation