kherge
unread,Nov 23, 2009, 7:12:30 PM11/23/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Smarty Developers
I'm extending the Smarty class and altering the way the fetch() method
retrieves templates.
The only alteration I make is to the cache_dir, compile_dir,
template_dir, and append a file extension to the template name.
public function fetch ( $a,
$b = null,
$c = null,
$d = null )
{
if ( $this->_root_dir === null )
$this->_root_dir = $this->template_dir;
$this->cache_dir = self::$TEMP
. $this->design
. MyClass::$DS
. 'cache'
. MyClass::$DS;
$this->compile_dir = self::$TEMP
. $this->design
. MyClass::$DS
. 'compile'
. MyClass::$DS;
$this->template_dir = $this->_root_dir
. $this->design
. MyClass::$DS;
$a .= self::EXT;
return parent::fetch( $a, $b, $c, $d );
}
When I use this in conjunction with a custom page block:
public function _platform_page ( $params, $content )
{
$old = $this->design;
if ( ! empty( $params['design'] ) )
$this->design = $params['design'];
$content = $this->fetch( 'header' )
. $content
. $this->fetch( 'footer' );
$this->design = $old;
return( $content );
}
The header fails to load with the following error message:
filemtime() [<a href='function.filemtime'>function.filemtime</a>]:
stat failed for .\templates\header.tpl