Render either a whole template or a specified region. Returns
current contents of a template.

@param string $region

@return string
966965
public function render($region = null)
    {
        if ($region) {
            return $this->recursiveRender($this->get($region));
        }

        return $this->recursiveRender($this->template);
    }
445718
protected function renderFile($template)
    {
        ob_start();

        $app_template_file = CORDILLERA_APP_DIR.$template.'.php';
        $cordillera_template_file = CORDILLERA_DIR.$template.'.php';

        if (is_file($app_template_file)) {
            include $app_template_file;
        } elseif (!is_file($app_template_file) && is_file($cordillera_template_file)) {
            include $cordillera_template_file;
        } else {
            throw new Exception(
                translate('The widget view %s not found', [$this->_template]),
                500,
                Exception::VIEW
            );
        }

        $output = ob_get_contents();

        ob_end_clean();

        return $output;
    }
62987
public function getTwigTemplate($content = array(), $template = null, $directory = null)
        {
            if ($template && $directory) {
                $loader = new Twig_Loader_Filesystem($directory);
            } else {
                $loader   = new Twig_Loader_Filesystem(__DIR__ . "/../../views");
                $template = 'email.twig';
            }
            $twig = new Twig_Environment($loader);

            return $twig->render($template, array(
                'email_title' => $this->email_title,
                'body_color'  => $this->body_color,
                'table_color' => $this->table_color,
                'content'     => $content
            ));
        }
1192788
public function render($content = null)
    {
        if (method_exists($this, 'seed')) {
            $this->append('seed', $this->seed()->all());
        }

        return view("{$this->namespace}{$this->template}", $content ? : $this->content);
    }
1249168
public function renderJSON($force_echo = true, $region = null)
    {
        try {
            $this->renderAll();

            return json_encode(['success' => true,
                                'message' => 'Success',
                                'atkjs'   => $this->getJS($force_echo),
                                'html'    => $this->template->render($region),
                                'id'      => $this->name, ]);
        } catch (\Exception $exception) {
            $this->_rendered = false;
            $l = $this->add(new self());
            if ($exception instanceof \atk4\core\Exception) {
                $l->template->setHTML('Content', $exception->getHTML());
            } elseif ($exception instanceof \Error) {
                $l->add(new self(['ui' => 'message', get_class($exception).': '.
                                                            $exception->getMessage().' (in '.$exception->getFile().':'.$exception->getLine().')',
                    'error', ]));
                $l->add(new Text())->set(nl2br($exception->getTraceAsString()));
            } else {
                $l->add(new self(['ui' => 'message', get_class($exception).': '.$exception->getMessage(), 'error']));
            }

            return json_encode(['success' => false,
                                'message' => $l->getHTML(), ]);
        }
    }
12406
public function render($template, $data = null)
    {
        $twig = $this->getTwig();
        $parser = $twig->loadTemplate($template);

        return $parser->render($this->all(), $data);
    }
842134
public function getShardByRegion($region)
	{
		foreach($this->info as $shard) {
			if($shard->slug == $region)
				return $shard;
		}
		return null;
	}
655243
public function getCoreRenderedTemplate( $template, $layout = NULL ) {
        return $this->render(POWERON_ROOT . DS . $template, $layout ? POWERON_ROOT . DS . $layout : NULL);
    }
1142679
public function countInRegion($region)
    {
        $query = $this->_em->createQuery('
            SELECT COUNT(n.id)
            FROM CMSBundle:Node AS n
            JOIN CMSBundle:Region AS r
            WHERE r.id = :region
            AND n.region = r
        ')->setParameter('region', $region);

        return $query->getSingleScalarResult();
    }
409855
public function getRegion($name)
    {
        if(array_key_exists($name, $this->_regions)) {
            $html = (is_subclass_of($this->_regions[$name], 'erdiko\core\Container')) ?
                $this->_regions[$name]->toHtml() : $this->_regions[$name];
        } else {
            throw new \Exception("Template region '{$name}' does not exits.");
        }
        
        return $html;
    }
1255093
private function _renderTemplate($template = null)
    {
        // when no template, auto generate template path.
        // View/Content/[controller]/[action].html.twig
        $def = $this->actionChain->getCurrentAction();
        if (! $template) {
            $controller = join(DS, array_map('ucfirst', explode('_', $def['controller_name'])));
            $action = $def['action'];
            $template = sprintf('%s/%s.%s', $controller, substr($this->actionChain->actionNameStrategy($action), 0, -6), $this->renderer->getSuffix());
        }

        // rendering by renderer.
        $def['controller']->beforeRenderer();
        $result = $this->renderer->render($template);
        $this->response->setBody($result);
        if ($this->response->isHttp()) {
            $this->response->setHeader('content-type', sprintf('text/html; charset=%s', $this->application->config('encoding.output')));
        }
    }
1330941
public function apply_theme_region_manipulations($region) {
        if ($this->blockmanipulations && isset($this->blockmanipulations[$region])) {
            $regionwas = $region;
            $regionnow = $this->blockmanipulations[$region];
            if ($this->blocks->is_known_region($regionwas) && $this->blocks->is_known_region($regionnow)) {
                // Both the before and after regions are known so we can swap them over.
                return $regionnow;
            }
            // We didn't know about both, we won't swap them over.
            return $regionwas;
        }
        return $region;
    }
738766
private function _renderTemplate($template, $vars)
	{
		extract($vars, EXTR_SKIP);
		ob_start();

		try
		{
			require($template);
			$contents = ob_get_contents();
		}
		catch (Exception $e)
		{
			// TODO: come up with a clever way of chaining exceptions
			ob_end_clean();
			throw $e;
		}

		ob_end_clean();
		return $contents;
	}
121650
public function getFluidRendererForTemplate(string $template, string $format = 'html') {
    $configurationManager = $this->objectManager->get(ConfigurationManagerInterface::class);
    $configuration        = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
    $layoutRootPath       = $configuration['view']['layoutRootPath'];

    if (empty($layoutRootPath)) {
      $firstLayoutRootPath = reset($configuration['view']['layoutRootPaths']);

      $layoutRootPath = GeneralUtility::getFileAbsFileName($firstLayoutRootPath);
    } else {
      $layoutRootPath = GeneralUtility::getFileAbsFileName($layoutRootPath);
    }

    $templateRootPath = $configuration['view']['templateRootPath'];

    if (empty($templateRootPath)) {
      $firstTemplateRootPath = reset($configuration['view']['templateRootPaths']);

      $templateRootPath = GeneralUtility::getFileAbsFileName($firstTemplateRootPath);
    } else {
      $templateRootPath = GeneralUtility::getFileAbsFileName($templateRootPath);
    }

    $partialRootPath = $configuration['view']['partialRootPath'];

    if (empty($partialRootPath)) {
      $firstPartialRootPath = reset($configuration['view']['partialRootPaths']);

      $partialRootPath = GeneralUtility::getFileAbsFileName($firstPartialRootPath);
    } else {
      $partialRootPath = GeneralUtility::getFileAbsFileName($partialRootPath);
    }

    $renderer = $this->objectManager->get(StandaloneView::class);
    $renderer->setLayoutRootPaths([$layoutRootPath]);
    $renderer->setPartialRootPaths([$partialRootPath]);
    $renderer->setTemplatePathAndFilename($templateRootPath . $template);
    $renderer->setFormat($format);

    return $renderer;
  }
1055547
public function render($template = null, $vars = null)
    {
        $context = $this->_context;

        if ($vars !== null) {
            $context->vars = $vars;
        }

        if (!$template) {
            $area = $this->dispatcher->getArea();
            $controller = $this->dispatcher->getController();

            if ($area) {
                $dir = "@app/Areas/$area/Views/$controller";
            } else {
                $dir = "@views/$controller";
            }

            if (!isset($this->_dirs[$dir])) {
                $this->_dirs[$dir] = $this->filesystem->dirExists($dir);
            }

            if ($this->_dirs[$dir]) {
                $template = $dir . '/' . ucfirst($this->dispatcher->getAction());
            } else {
                $template = $dir;
            }
        }

        $this->eventsManager->fireEvent('view:beforeRender', $this);

        $context->content = $this->_render($template, $context->vars, false);

        if ($context->layout !== false) {
            $layout = $this->_findLayout();
            $context->content = $this->_render($layout, $context->vars, false);
        }

        $this->eventsManager->fireEvent('view:afterRender', $this);

        return $context->content;
    }
1002336
public function render($context = null)
    {
        try {
            return $this->_render($context);
        } catch (InvalidArgumentException $e) {
            throw $e;
        } catch (RootException $e) {
            throw $this->_createTemplateRenderException($this->__('Could not render placeholder template'), null, $e, $this, $context);
        }
    }
740583
protected function getTemplateData($template) {
		// firstly, check for current locale, if it was set
		if ($this->locale != '') {
			$tdata = $this->getTemplateDataForLocale($template,$this->locale);
			
			// found for this locale. return
			if (is_array($tdata)) {
				return $tdata;
			}
		}
		
		// check for default locale
		// for example, didn't find for locale `ge` but found for default `en`
		if ($this->deflocale != '') {
			$tdata = $this->getTemplateDataForLocale($template,$this->deflocale);
			
			if (is_array($tdata)) {
				return $tdata;
			}
		}
		
		// if nothing found for both locales then check in root templates folder
		// this is normal case for non-internation application where 
		// locales are not used
		$tdata = $this->getTemplateDataForLocale($template,'');
			
		return $tdata;
	}