[pLog-svn] r4454 - plog/trunk/class/template
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Fri Dec 29 22:58:40 GMT 2006
Author: oscar
Date: 2006-12-29 22:58:40 +0000 (Fri, 29 Dec 2006)
New Revision: 4454
Modified:
plog/trunk/class/template/template.class.php
Log:
We have to look for the requested file in all template folders, as defined by the Smarty::template_dir array, not just in ".".
Modified: plog/trunk/class/template/template.class.php
===================================================================
--- plog/trunk/class/template/template.class.php 2006-12-29 19:28:42 UTC (rev 4453)
+++ plog/trunk/class/template/template.class.php 2006-12-29 22:58:40 UTC (rev 4454)
@@ -119,9 +119,17 @@
else {
// include the user's template unless it is not available, in which case we'll use the
// default one
- if( !File::isReadable( $params['smarty_include_tpl_file'] )) {
- $params['smarty_include_tpl_file'] = $defaultTemplateFile;
- }
+ $readable = false;
+ foreach( $this->template_dir as $templateDir ) {
+ if( File::isReadable( $templateDir."/".$params['smarty_include_tpl_file'] )) {
+ $readable = true;
+ break;
+ }
+ }
+ if( !$readable ) {
+ // if the file wasn't found in any of the template folders, then we should be using the default one
+ $params['smarty_include_tpl_file'] = $defaultTemplateFile;
+ }
}
}
@@ -148,6 +156,9 @@
* Returns the name of the template file
*
* @return The name of the template file
+ *
+ * :TODO:
+ * This code could do with some refactoring, its' pretty similar to what we've got in Template::_smarty_include()
*/
function getTemplateFile()
{
@@ -159,8 +170,16 @@
$this->_templateFile = $defaultTemplateFile;
}
}
- else {
- if( !File::isReadable( $config->getValue( "template_folder" )."/".$this->_templateFile )) {
+ else {
+ $readable = false;
+ foreach( $this->template_dir as $templateDir ) {
+ if( File::isReadable( $templateDir."/".$this->_templateFile )) {
+ $readable = true;
+ break;
+ }
+ }
+ if( !$readable ) {
+ // if the file wasn't found in any of the template folders, then we should be using the default one
$this->_templateFile = $defaultTemplateFile;
}
}
More information about the pLog-svn
mailing list