Render a string

@param  string $template
@param  array|null $params
@return string
351270
public function renderString($template, array $params = null)
    {
        if (! empty($params)) {
            $this->assign($params);
        }

        $compiled = $this->getCompiler()->compile($template);

        $tempFile = tempnam(sys_get_temp_dir(), __FUNCTION__);

        $this->writeToFile($tempFile, $compiled);

        $template = $this->readBuffer($tempFile);

        unlink($tempFile);

        return $template;
    }
491848
public function renderStringTemplate(string $string, array $parameters = []): string
    {
        try {
            $parameters = iterator_to_array($this->getTemplateVariables($parameters));

            $environment = new Environment(new ArrayLoader());
            $template = $environment->createTemplate($string);

            return $environment->resolveTemplate($template)->render($parameters);
        } catch (Throwable $t) {
            return '';
        }
    }
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);
	}
512903
public function render($params = null)
    {
        $template = $this->getViewer($this->getAction());

        // if the object is already customised (e.g. through Controller->run()), use it
        $obj = $this->getCustomisedObj() ?: $this;

        if ($params) {
            $obj = $this->customise($params);
        }

        return $template->process($obj);
    }
87332
public Renderable<?> render(Template template, Map<String, Object> parameters) {
        return template.render(this, parameters);
    }
764188
protected function render(Response $response, $template, array $params = [])
    {
        return $this->container['twig']->render($response, $template, $params);
    }
12406
public function render($template, $data = null)
    {
        $twig = $this->getTwig();
        $parser = $twig->loadTemplate($template);

        return $parser->render($this->all(), $data);
    }
834231
public function render($cache = false, $params = array())
	{
		// If no error object is set return null
		if (!isset($this->error))
		{
			return;
		}

		// Set the status header
		//\App::get('response')->headers->set('status', $this->error->getCode() . ' ' . str_replace("\n", ' ', $this->error->getMessage()));

		$file = 'error.php';

		// Check template
		$directory = isset($params['directory']) ? $params['directory'] : PATH_CORE . '/templates';
		$template  = isset($params['template'])  ? ltrim(preg_replace('/[^A-Z0-9_\.-]/i', '', (string) $params['template']), '.') : 'system';

		if (!file_exists($directory . DS . $template . DS . $file))
		{
			$directory = PATH_CORE . '/templates';
			$template = 'system';
		}

		// Set variables
		$this->baseurl  = (isset($params['baseurl']) ? $params['baseurl'] : rtrim(\Request::root(true), '/') . rtrim(substr(dirname($directory), strlen(PATH_ROOT)), '/'));
		$this->template = $template;
		$this->debug    = isset($params['debug']) ? $params['debug'] : false;

		// Load
		$data = $this->loadTemplate($directory . DS . $template, $file);

		parent::render();

		return $data;
	}
1233288
public function render(string $template, array $data = []): string
    {
        // we store the current state of the template variables
        // so that we have isolated cases on multiple calls to render()
        $backupVariables = $this->thisShouldMakeItUniqueCodeCollabTemplateHtmlVariables;

        if (!empty($data)) {
            $this->thisShouldMakeItUniqueCodeCollabTemplateHtmlVariables = $data;
        }

        try {
            ob_start();

            /** @noinspection PhpIncludeInspection */
            require $template;
        } finally {
            $output = ob_get_clean();
        }

        $this->thisShouldMakeItUniqueCodeCollabTemplateHtmlVariables = $backupVariables;

        return $output;
    }
47630
public function render($template = null)
    {
        if (null === $template) {
            $template = 'SilvestraAdminBundle:Menu:vertical_admin_menu.html.twig';
        }

        return $this->helper->render($template, $this->builder->build());
    }
420372
protected function renderDefaultTemplate($template, $params=[]) {
		if(!file_exists($template)) {
			$template = $this->solveTemplatePath($orig = $template);
			if(!file_exists($template))
				throw new \Exception('The template file "'.$orig.'" could not be found.');
		}

		extract($params);

		ob_start();
		include($template);
		return ob_get_clean();
	}
941840
public function renderTwig(\Twig_Environment $environment, $template, array $parameters = array())
    {
        $template = $this->loadStringTemplate($environment, $template);

        return $template->render($parameters);
    }
233546
public static function iempty($value = null, array $params, Template $template)
    {
        if (!empty($value)) {
            return $value;
        }
        $template = clone $template;
        $placeholders = array_merge(
            !empty($params['addPlaceholders']) ? $template->findPlaceholders($params['addPlaceholders']) : [],
            ['output' => $value]
        );

        return $template->replace($params['then'], $placeholders);
    }
242483
public function render($template)
    {
        $this->setTemplate($template);
        extract($this->data);
        ob_start();
        require $this->templatePath;

        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);
        }
    }
520673
public function renderInitCmsBlock($template, LayoutBlockInterface $layoutBlock, $params = [])
    {
        if (!$serializedContent = $layoutBlock->getSnapshotContent()) {
            // Draft View
            $contentItem = $layoutBlock->getContent();
        } else {
            // Live View
            $contentItem = $this->serializer->deserialize(
                $serializedContent,
                $layoutBlock->getClassType(),
                'json'
            );
        }

        if (!is_object($contentItem)) {
            $this->layoutBlockAdmin->delete($layoutBlock);

            return '---';
        }

        $options = $contentItem->getTemplateOptions($params);

        $options = array_merge($options, $params);

        return $this->templating->render($template, $options);
    }
633942
public function render(string $name, array $params = []): string
    {
        $path = $this->finder->findTemplate($name);
        $params = array_merge($this->attributes, $params);

        return $this->engine->render($path, $params);
    }