Elgg\ViewsService::setViewDir PHP Метод

setViewDir() публичный Метод

public setViewDir ( string $view, string $location, string $viewtype = '' )
$view string Name of the view
$location string Full path to the view file
$viewtype string The viewtype to register this under
    public function setViewDir($view, $location, $viewtype = '')
    {
        $view = $this->canonicalizeViewName($view);
        if (empty($viewtype)) {
            $viewtype = 'default';
        }
        $location = rtrim($location, '/\\');
        if ($this->fileExists("{$location}/{$viewtype}/{$view}.php")) {
            $this->setViewLocation($view, $viewtype, "{$location}/{$viewtype}/{$view}.php");
        } elseif ($this->fileExists("{$location}/{$viewtype}/{$view}")) {
            $this->setViewLocation($view, $viewtype, "{$location}/{$viewtype}/{$view}");
        }
    }

Usage Example

Пример #1
0
 public function testCanSetViewsDirs()
 {
     $this->views->setViewDir('static.css', __DIR__ . '/../test_files/views2/');
     $this->assertEquals('body{}', $this->views->renderView('static.css'));
 }