Render a template file given its full path and an array of data.

@param  string $path
@param  array  $data
@param  string $class
@return string
175888
public function renderTemplate($path, array $data = [], $class = null)
    {
        if (file_exists($path)) {
            return $this->doRender($path, $data, $class);
        }
        throw new RuntimeException(__METHOD__.' needs a valid template path as first argument.');
    }
667356
protected function render($template, $data = [])
    {
        $view = new View();
        $view->type(View::VIEW_TYPE_CELL);
        $view->set($data);
        $className = get_class($this);
        $namePrefix = '\View\Cell\\';
        $name = substr($className, strpos($className, $namePrefix) + strlen($namePrefix));
        $view->context(str_replace('\\', DIRECTORY_SEPARATOR, $name));
        return $view->render($template);
    }
646237
public function addMap($class, $path = null)
    {
        if (is_array($class)) {
            foreach ($class as $ns => $path) {
                $this->files->addMap($ns, $path);
            }
        } else {
            $this->files->addMap($class, $path);
        }

        return $this;
    }
196744
public function make(string $path, array $data = [])
	{
		$cached = $this->isCached($path);
		extract($data);

		ob_start();
		eval('?> '.$cached);
		$output = ob_get_contents();;
		ob_end_clean();
		return $output;
	}
441724
public function create($path, $data = array())
    {
        $path = $this->buildPath($path);

        if(!file_exists($path))
            throw new NotFoundException('Unable to find view ['.$path.']');

        // merge with default data.
        $class = '\Exedra\View\View';

        if(is_string($data))
        {
            // assume data as fully qualified class name
            if($data)
            {
                $class = $data;

                $data = array();
            }
        }
        else
        {
            if(!is_array($data))
                throw new NotFoundException('Argument 2 must be either string or array ['.gettype($data).'] given.');
        }

        $data = array_merge($data, $this->defaultData);

        return new $class($path, $data);
    }
1131757
protected function view(string $template, array $data = []) : string
    {
        if (!$this->mustacheInstance) {
            $viewsRoute = $this->config('paths.view');
            $options = ['extension' => '.hbs'];

            $this->mustacheInstance = new Mustache_Engine(array(
                'loader' => new Mustache_Loader_FilesystemLoader($viewsRoute, $options),
                'partials_loader' => new Mustache_Loader_FilesystemLoader($viewsRoute, $options),
                'charset' => 'UTF-8',
            ));
        }

        $tpl = $this->mustacheInstance->loadTemplate($template);
        $data = array_merge($this->getData(), $data);

        return $tpl->render($this->mapData($data));
    }
314643
public function get($path, array $data = [])
    {
        $name = array_search($path, $this->finder->getViews());

        return $this->twig->render($this->parseFileName($name).$this->extension, $data);
    }
687963
public function render(View $template, array $data = array())
    {
        if (! empty($this->data)) { // @codeCoverageIgnore
            $data = array_merge($this->data, $data); // @codeCoverageIgnore
        } // @codeCoverageIgnore

        // Path
        $path = $template->getFullPath();

        // Declare all data vars local if possible
        foreach ($data as $name => $value) {
            ${$name} = $value;
        }

        // Require and stop with OB.
        ob_start();

        require $path;

        return ob_get_clean();
    }
858336
public function render(string $template, array $data = []) : string
    {
        try {
            return $this->renderer->render($template, $data);
        } catch (Twig_Error_Loader $e) {
            throw new TemplateNotFoundException("Template '$template' not found by Twig renderer",
                null, $e);
        }
    }
922107
public function render($filename, array $data = [])
    {
        $filename = $this->checkParseFile($filename, false);

        return $this->template->render($filename, $data);
    }
977692
public static function file( $path, $data = [], $mergeData = [] )
	{
		return static::__do( __FUNCTION__, args_with_keys( func_get_args(), __CLASS__, __FUNCTION__ ) );
	}
407463
public function renderView($path, $data)
    {
        $obLevel = ob_get_level();
        ob_start();
        extract($data);

        /*
         | We will try to include view file and check content into try catch block
         | so that if any exception occurs output buffer will get flush out.
        */
        try {
            include $path;
        } catch (Exception $e) {
            $this->handleViewException($e, $obLevel);
        }

        return ltrim(ob_get_clean());
    }
432630
protected function view($path, $data = [])
    {
        $view = $this->baseViewPath . $path;
        // if view has package name (dont prefix)
        //if(strpos($path, "::") !== false) {
        //    $view = $path;
        //}

        // explode on package prefix
        // format view path
        $pieces = explode("::", $path);
        if (count($pieces) >= 2) {
            $view = $pieces[0] . "::";
            $view .= $this->baseViewPath . $pieces[1];
        }

        return view($view, $data)
            ->with('image', $this->getImage())
            ->with('title', $this->getTitle())
            ->with('description', $this->getDescription())
            ->with('pageTitle', $this->getPageTitle())
            ->with('page', $this->page)//->with('navigation', $this->navigation)
            ->with('activeParents', $this->urlParentPages)
            ->with('breadcrumbItems', $this->breadcrumbItems)
            ->with('navigation', $this->navigation);
    }
367054
public function renderWithData($path, $data = [])
    {
        foreach ($data as $key => $value) {
            $this->add($key, $value);
        }

        $this->render($path);

        return $this;
    }
503194
protected function _render($story, $paths, $data)
    {
        settype($paths, 'array');

        foreach ($paths as $path) {
            if ($this->_template->findFile($path)) {
                return $this->_template->loadFile($path, $data)->render();
            }
        }

        try {
            return $this->_template->loadTemplate($story->name, $data)->render();
        } catch (Exception $e) {
            print '<small>file missing :'.$path.'</small>';
        }
    }
755588
public function compile(string $path, array $data = [])
    {
        // If the file can't be found it's probably supplied as a template within
        // one of the base directories
        $path = $this->find($path);

        // Make sure that we use the right resolver for the initial file
        $engine = $this->factory->getEngineFromPath($path);

        // this path needs to be string
        return $view = new View(
            $this->factory,
            $engine,
            $path, // view (not sure what it does)
            $path,
            $data
        );
    }
1267313
protected function view($path, $data = [])
    {
        $view = $this->baseViewPath . $path;

        // explode on package prefix
        // format view path
        $pieces = explode("::", $path);
        if (count($pieces) >= 2) {
            $view = $pieces[0] . "::";
            $view .= $this->baseViewPath . $pieces[1];
        }

        return view($view, $data)
            ->with('image', $this->getImage())
            ->with('title', $this->getTitle())
            ->with('description', $this->getDescription());
    }