Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

SourceResolver.php

Go to the documentation of this file.
00001 <?php 00002 00011 class PHPTAL_SourceResolver 00012 { 00036 function resolve($path, $repository=false, $callerPath=false) 00037 { 00038 // first look at an absolute path 00039 $pathes = array($path); 00040 // search in the caller directory 00041 if ($callerPath) { 00042 $pathes[] = dirname($callerPath) . PHPTAL_PATH_SEP . $path; 00043 } 00044 // search in the template repository 00045 if ($repository) { 00046 $pathes[] = $repository . PHPTAL_PATH_SEP . $path; 00047 } 00048 // search in the defined repository 00049 if (defined('PHPTAL_REPOSITORY')) { 00050 $pathes[] = PHPTAL_REPOSITORY . PHPTAL_PATH_SEP . $path; 00051 } 00052 foreach ($pathes as $ftest) { 00053 if (file_exists($ftest)) { 00054 $realpath = realpath($ftest); 00055 $locator = new PHPTAL_SourceLocator($realpath); 00056 return $locator; 00057 } 00058 } 00059 return false; 00060 } 00061 } 00062 00063 ?>

Generated on Tue Jun 29 23:40:07 2004 for Mediawiki by doxygen 1.3.7