eesyphp/src/TplSmartyResource.php

45 lines
1.1 KiB
PHP
Raw Normal View History

<?php
namespace EesyPHP;
use Smarty_Resource_Custom;
/**
* Smarty ressource for EesyPHP templates
*
* @author Benjamin Renard <brenard@zionetrix.net>
*/
class TplSmartyResource extends Smarty_Resource_Custom {
// prepared fetch() statement
protected $fetch;
// prepared fetchTimestamp() statement
protected $mtime;
/**
* Fetch a template and its modification time
*
* @param string $name template name
* @param string $source template source
* @param integer $mtime template modification timestamp (epoch)
* @return void
*/
protected function fetch($name, &$source, &$mtime) {
$source = Tpl :: get_template_source($name);
$mtime = Tpl :: get_template_timestamp($name);
}
/**
* Fetch a template's modification time
*
* Note: implementing this method is optional. Only implement it if modification times can be
* accessed faster than loading the comple template source.
*
* @param string $name template name
* @return integer timestamp (epoch) the template was modified
*/
protected function fetchTimestamp($name) {
return Tpl :: get_template_timestamp($name);
}
}