Renders a given file with the supplied variables.

@access public
@param string $file    The file to be rendered.
@param mixed $vars     The variables to be substituted in the view.
@return string
@throws \LogicException
358416
public function render($file, $vars = null) 
    {
        $template = '';

        if (is_null($this->templatesPath)) {
            throw new \LogicException('Variable "templatesPath" can\'t be NULL.');
        } else if (is_string($this->templatesPath) && !file_exists($this->templatesPath)) {
            throw new \LogicException(sprintf('Folder "%s" don\'t exists.', $this->templatesPath));
        } else if (is_array($this->templatesPath)) {
            foreach ($this->templatesPath as $folderPath) {
                if (file_exists($template = "$folderPath/{$file}")) {
                    break;
                }
            }
        }
        
        if (!$template) {
            $template = "$this->templatesPath/{$file}";
        }
        
        if(!file_exists($template)){
           throw new \LogicException(sprintf('View "%s" don\'t exists.', $template));
        }
        
        if (is_array($vars)) {
            extract($vars);
            foreach ($vars as $key => $value) {
                $key = $value;
            }
        }        
        
        ob_start();
        require $template;
        return ob_get_clean();
    }
750104
protected function render( $filepath, $vars ) {
		$filepath = __DIR__ . '/../../../view/' . $filepath . '.php';
		if ( file_exists( $filepath ) ) {
			ob_start();
			// @todo Using getter method
			// @codingStandardsIgnoreStart
			extract( $vars );
			// @codingStandardsIgnoreEnd
			include( $filepath );
			return ob_get_clean();
		}
	}
900576
public function render($view, array $vars = [])
    {
        if ($vars) {
            $this->vars = array_merge($this->vars, $vars);
        }

        $output = $this->includeView($view, $this->vars, $return_content = true);

        while ($this->block_stack) {
            $this->endBlock();
        }

        if (!$extend_view = $this->extend_view) {
            return $output;
        }

        $this->extend_view = null;

        return $this->render($extend_view);
    }
1136609
public function renderFile(File &$file)
    {
        if ($file->isRendered()) {
            return;
        }
        $fileRenderer = $this->get($file->getExt());
        $file->setContent($fileRenderer->render($file));
        $file->setExt($fileRenderer->getDestinationExtension($file->getExt()));
        $file->setRendered(true);
        $fileRenderer->mutateFile($file);
    }
348712
public function renderTemplate($template, $vars)
    {
        $twig = $this->getContainer()->get('twig');

        $template = $twig->createTemplate($template);

        return $template->render($vars);
    }
362365
private function load($file)
    {
        if (null === $this->command) {
            $this->command = Yaml::parse($file);
        }
        return $this->command;
    }
135440
private function doRender($file, $data)
    {
        $this->view_data               = array_merge($this->view_data, $data);
        if (is_array($file)) {
            foreach($file as $key => $val) {
                $this->section->set($key, $val);
            }
        }
        elseif(!$this->view_file = $this->getPath($file)) {
            return null;
        }
        else {
            $this->setContent($this->renderViewFile());
        }
        if (!isset($this->layout_file)) {
            return $this->section->get('content');
        }
        $layout              = clone($this);
        $layout->layout_file = null;
        return $layout->doRender($this->layout_file, $this->view_data);
    }
810710
public function loadJSTemplate($file, $vars, $uniquenessID = null)
    {
        // Load File Contents:
        
        $script = file_get_contents(Director::getAbsFile($file));
        
        // Initialise Search / Replace Arrays:
        
        $s = [];
        $r = [];
        
        // Process Variable Array:
        
        if ($vars) {
            
            foreach ($vars as $k => $v) {
                
                if (strtolower(substr($k, 0, 5)) == 'json:') {
                    $s[] = '$' . substr($k, 5);
                    $r[] = Convert::raw2json($v);
                } else {
                    $s[] = '$' . $k;
                    $r[] = str_replace("\\'", "'", Convert::raw2js($v));
                }
                
            }
            
        }
        
        // Replace Script Variables:
        
        $script = str_replace($s, $r, $script);
        
        // Load Custom Script:
        
        Requirements::customScript($script, $uniquenessID);
    }
1196591
public function render($file = '')
    {
        $viewManager = $this->config->get('view_manager');

        if ($viewManager['template_path_stack']) {
            $file = $viewManager['template_path_stack'] . '/' . $file;
        }

        $fileInfo = pathinfo($file);
        if (! isset($fileInfo['extension']) || $fileInfo['extension'] != 'phtml') {
            $file = $file . '.phtml';
        }

        if (is_file($file)) {
            if (! headers_sent()) {
                header('X-Generator: JiNexus Framework');
            }

            ob_start();
            include $file;
            ob_end_flush();
        } else {
            throw new Exception('View not found');
        }
    }
929635
public function render($file, $data = [])
    {
        if ($data instanceof \Traversable) {
            $data = iterator_to_array($data);
        }

        if (is_object($data)) {
            $data = get_object_vars($data);
        }

        return $this->getEngine()->make($file, (array) $data)->render();
    }
191601
public function display($file, $vars = [])
    {
        if ((DIRECTORY_SEPARATOR !== $file[0]) && (':' !== $file[1])) { // get path if not full path was sent
            $moduleFolder = $this->request->getModulePath();
            $controllerFolder = $this->request->getController();
            $viewsFolder = str_replace(['{APP_ROOT}', '{MODULE_FOLDER}', '{CONTROLLER}', '{LIBS_FOLDER}', '{DIRECTORY_SEPARATOR}'], [
                APP_ROOT, $moduleFolder, $controllerFolder, LIBS_FOLDER, DIRECTORY_SEPARATOR
            ], $this->viewsFolder);
            $file = $viewsFolder . DIRECTORY_SEPARATOR . $file . '.php';
        }
        foreach ($this->_displayVars as $k => $v) {
            $$k = $v;
        }
        foreach ($vars as $k => $v) {
            $$k = $v;
        }
        require $file;
    }
1034292
public static function render_file($file, $params = array(), $sandbox=false){

        $obj = new self();

        return $obj->file($file, $params, $sandbox);
    }
1240369
public function load($file, $data = null)
    {
        $data = array_merge($this->data, (array) $data);

        $renderer = $this->createSelf();

        return $renderer->render($file, $data);
    }
1033950
protected function render(string $template, array $vars = [])
    {
        $vars['flash'] = $this->flash;
        $this->view->setVars($vars);

        $content = $this->view->render($template);
        $this->response->setContent($content);

        return $this->response;
    }
85098
public function render($file, $data = [])
    {
        $filepath = $this->findTemplateFile($file);
        extract($data);
        ob_start();
        include $filepath;
        $content = ob_get_contents();
        @ob_end_clean();
        return $content;
    }
1354698
public function mutateFile(File &$file)
    {
        // If markdown file has a layout associated with it, we need to ensure it gets rendered within that
        if ($file->hasData('layout')) {
            $file->setExt('phtml');     // Templates are managed by the phtml renderer
            $file->setRendered(false);  // Set rendered to false so that within Compile.php's Execute Renderers loop it gets re-rendered
        }
    }
847364
public function display ($file, $output = TRUE)
	{

		// If there is no template directory set then try and use default root/templates directory

		if (!$this->templateDir)
		{
			$this->templateDir	= ABS_ROOT . 'templates' . DIRECTORY_SEPARATOR;
		}

		// Load template

		$template	= $this->loadTemplateFile ($file);

		// Replace variables

		if ($this->replaceVars)
		{
			$rendered	= $this->replaceVars ($template);
		} else {
			$rendered	 = $template;
		}

		// Output

		if ($output)
		{
			echo $rendered;
		}

		// Return template

		return $rendered;

	}