예제 #1
0
 public function resolveTemplatePath($viewName, &$base = null)
 {
     $dirs = $this->engineSettings->getDirectories();
     foreach ($dirs as $base) {
         $p = "{$base}/{$viewName}";
         if ($p = $this->findTemplate($p)) {
             return $p;
         }
     }
     // Throw an exception
     $paths = implode('', map($dirs, function ($path) {
         return "  <li><path>{$path}</path>\n";
     }));
     throw new FileNotFoundException($viewName, "\n<p>Search paths:\n\n<ul>{$paths}</ul>");
 }
예제 #2
0
 /**
  * Registers a mapping between the given PHP namespace and the module's view templates base directory that will be
  * used for resolving view template paths to PHP controller classes.
  *
  * @param ModuleInfo $moduleInfo
  * @param string     $namespace
  * @param string     $basePath [optional] A base path for mapping, relative to the module's view templates directory.
  * @return $this
  */
 function registerControllersNamespace(ModuleInfo $moduleInfo, $namespace, $basePath = '')
 {
     if ($basePath) {
         $basePath = "/{$basePath}";
     }
     $this->controllerNamespaces["{$moduleInfo->path}/{$this->viewEngineSettings->moduleViewsPath()}{$basePath}"] = $namespace;
     return $this;
 }