Add data to render.

@param  array  $data      Data
@param  string $templates Template
@return League\Plates\Engine
181672
public function addData(array $data, $templates = null)
    {
        $this->engine->addData($data, $templates);

        return $this->engine;
    }
1220429
protected function render(array $data = [], $template = null)
    {
        if (!$template) {
            $template = $this->template;
        }

        $template = (!empty($template)) ? $template : $this->router->directory . $this->router->class . '/' . $this->router->method;
        $data = array_merge($this->data, $data);
        if ($this->input->is_ajax_request()) {
            $this->layout = false;
        } else {
            if (!isset($data['page_title'])) {
                $data['page_title'] = 'lang:' . $this->router->class . '_title_' . $this->router->method;
            }
        }
        $view = new View($this->layout);
        $view->set($data);
        $this->output->set_output($view->render($template));

        if ($this->layout && ($csp = config_item('csp_protection'))) {
            // Add CSP
            if (!isset($csp['script-src'])) {
                $csp['script-src'] = ['self'];
            }
            $asset = Asset::getInstance();
            foreach ($asset->getScriptNonces() as $nonce) {
                $csp['script-src'][] = "'nonce-".$nonce."'";
            }
            $string = '';
            foreach ($csp as $key => $values) {
                $string .= " " . $key . " " . implode(" ", $values) .";";
            }
            if ($report = config_item('csp_report')) {
                $string .= " report-uri " . $report;
            }
            if (config_item('csp_report_only')) {
                $this->output->set_header('Content-Security-Policy-Report-Only:'. $string);
                //var_dump($csp);die;
            } else {
                $this->output->set_header('Content-Security-Policy:'. $string);
            }
        }
    }
252071
public function addTemplate($name, $string, $data = [])
    {
        $this->templates[$name] = SimpleTemplate::render($string, $data);

        return $this;
    }
1299037
public function makeHtml($template, $data=null)
	{
		$content = $this->render($template, $data);
		return File::write($this->getHtmlFile($template), $content); 
	}
119372
private function fillTemplate($templateData)
    {
        $templateData = str_replace(
            '$NAMESPACE_CONTROLLER$',
            config('webcore.laravel_generator.namespace.controller'), $templateData
        );

        $templateData = str_replace(
            '$NAMESPACE_REQUEST$',
            config('webcore.laravel_generator.namespace.request'), $templateData
        );

        return $templateData;
    }
284696
public function setTemplateData(array $templateData)
    {
        if (!isset($this->templateData)) {
            $this->templateData = [];
        }

        $this->templateData = array_merge($this->templateData, $templateData);

        return $this;
    }
626483
public function addData($data) : void
    {
        Assert::isInstanceOfAny($data, [Chunk::class, X509Certificate::class]);
        $this->data[] = $data;
    }
332885
protected function renderTemplate($input, $outputFile, $template, $templates, $data = [])
    {
        $paths = [$templates];

        if ($templates = $input->getOption('templates')) {
            $paths []= $templates;
        }

        $paths = array_filter($paths);

        $loader = new Twig_Loader_Filesystem($paths);
        $twig = new Twig_Environment($loader);


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

        $dataOption = $input->getOption('data');

        if (file_exists($dataOption)) {
            $dataOption = file_get_contents($dataOption);
        }

        $dataOption = json_decode(stripcslashes($dataOption), true);

        if (!is_array($dataOption)) {
            $dataOption = [];
        }

        $data = array_merge($data, $dataOption);

        @mkdir(dirname($outputFile), 0755, true);
        file_put_contents($outputFile, $template->render($data));
    }
1283743
public function setTemplate($templateName, $data = [])
    {
        if (!empty($data)) {
            if (is_array($data)) {
                $this->_data = array_merge($this->_data, $data);
            }
        }

        return $this;
    }
542647
public static function render($template, $data = [])
    {
        // @var \Illuminate\View\Factory $factory
        $factory = self::instance()->view();

        // @var \Illuminate\Contracts\View\View $view
        $view = $factory->make($template, $data);

        return $view->render();
    }
1240533
public function add(array $templates)
    {
        $this->setConfig($templates);
        $this->_compileTemplates(array_keys($templates));

        return $this;
    }
1118693
public function render($template, $data = [], array $options = []) {
		$defaults = ['context' => []];
		$options += $defaults;

		$context = [];
		$this->_context = $options['context'] + $this->_context;

		foreach (array_keys($this->_context) as $key) {
			$context[$key] = $this->__get($key);
		}
		$data = array_merge($this->_toString($context), $this->_toString($data));
		return Text::insert($template, $data, $options);
	}
517414
public function generate($data){
		$this->setTitle(BLang::_('USERS_REGISTER_HTML_TITLE'));
		$this->addMeta('description',BLang::_('USERS_REGISTER_METADESC'));
		return $this->templateLoad();
		}
49858
public function store($data)
    {
        $template = $this->client->post('templates.json', [
            'json' => $data,
        ]);

        return new Template($this->response($template));
    }
10723
public function render($template, $data = array()) {
		if(!is_null($this->layout) && $this->enabled === TRUE) { // Render the layout!!
			$this->setLayoutData('content', parent::render($template, array_merge($this->layoutData, (array)$data)));
			$this->setLayoutData('js', $this->jsAssets->render());
			$this->setLayoutData('css', $this->cssAssets->render());
			$this->setLayoutData('title', $this->titleParts->render());

			return parent::render($this->layout, $this->layoutData);
		} else {
			return parent::render($template, $data);
		}
	}
7468
public function render(array $data = [])
    {
        $this->data($data);
        unset($data);
        extract($this->data);

        if (! $this->exists()) {
            throw new LogicException(
                'The template "'.$this->name->getName().'" could not be found at "'.$this->path().'".'
            );
        }

        try {
            $level = ob_get_level();
            ob_start();

            include $this->path();

            $content = ob_get_clean();

            if (isset($this->layoutName)) {
                $layout = $this->engine->make($this->layoutName);
                $layout->setFile($this->file);
                $layout->sections = array_merge($this->sections, ['content' => $content]);
                $content = $layout->render($this->layoutData);
            }

            return $content;
        } catch (Throwable $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }

            throw $e;
        } catch (Exception $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }

            throw $e;
        }
    }
952132
protected function _include($template, $data = NULL)
    {
        // Merge local data with global data
        $data = isset($data) ? array_merge($this->_data, $data) : $this->_data;
        // Compile and run template
        $compiled = $this->_compile($template);

        return $this->_run($compiled, $data);
    }