Render a view template.

@param (string) $file Name of files.
@param (array)  $args Attributes.

@since 1.0.0

@return void
344037
public static function renderTemplate($file, $args = [])
    {
        if (!empty($file)) {
            self::setFile($file);
            extract($args, EXTR_SKIP);
            if (file_exists(self::$file)) {
                ob_start();
                require_once self::$file;
            } else {
                throw new \Exception("Sorry, view file {$file} not exists", 404);
            }
        } else {
            throw new \Exception('Sorry, file much be provided', 404);
        }
    }
1022129
public function render($file, $data = [])
    {
        $file = pathinfo($file, PATHINFO_EXTENSION) === 'twig' ? $file : $file . '.twig';

        $this->extensions = array_merge($this->extensions, (array) $this->config->get('extensions', []));

        return $this->getEngine()->render($file, $data);
    }
870327
function renderChapterLabelField( $args ) {
		unset( $args['label_for'], $args['class'] );
		$this->renderField(
			[
				'id' => 'chapter_label',
				'name' => 'pressbooks_theme_options_' . $this->getSlug(),
				'option' => 'chapter_label',
				'value' => getset( $this->options, 'chapter_label' ),
				'description' => $args[0],
				'type' => 'text',
				'class' => 'regular-text',
			]
		);
	}
1124006
public function view($view, $args = []){
        if(is_array($view)) {
            if(isset($view['theme'])) $this->theme($view['theme']);
            if(isset($view['layout'])) $this->layout($view['layout']);
            if(isset($view['cookie'])) $this->withCookie($view['cookie']);
            $statusCode = (isset($view['statusCode'])) ? $view['statusCode'] : 200;
                        
            if(empty($args)) 
                if(isset($view['args'])) $args = $view['args'];

            
            $view = $view['view'];
        }

        $this->uses($this->theme)->layout($this->layout);

        return $this->watch($view, $args)->render();
    }
860847
protected function _render_widget( $args, $instance ) {
		$widget_templates = apply_filters( 'inc2734_wp_awesome_widgets_widget_templates', 'templates/widget' );
		$default_template = $this->_path . '/_widget.php';
		$custom_template  = $widget_templates . '/' . basename( $this->_path );

		ob_start();

		if ( file_exists( get_theme_file_path( $custom_template . '.php' ) ) ) {
			include( get_theme_file_path( $custom_template . '.php' ) );
		} elseif ( file_exists( $default_template ) ) {
			include( $default_template );
		}

		$widget = ob_get_clean();

		if ( empty( $widget ) ) {
			return;
		}

		// @codingStandardsIgnoreStart
		echo apply_filters( 'inc2734_wp_awesome_widgets_render_widget', $widget, $args, $instance );
		// @codingStandardsIgnoreEnd
	}
300841
public function render($file = null)
    {
        if (null !== $file)
        {
            $this->setFilename($file);
        }

        if (empty($this->_file))
        {
            throw new ViewException('You must set the file to use within your view before rendering');
        }

        return $this->capture($this->_file, $this->_data);
    }
1252701
public function render_module_template( string $name, array $args ) {
		if ( ! apply_filters( 'hogan/module/' . $name . '/show_in_rest', true ) && \hogan_is_rest() ) {
			return;
		}

		// Get the right module.
		$module = $this->get_module( $name );

		if ( $module instanceof Module ) {
			$module->render_template( $args, $this->_module_counter );
			$this->_module_counter++;
		}
	}
949119
public function renderFile(File $file, array $data = [])
    {
        $this->data($data);
        unset($data);

        $this->file = $file;
        $tmpDirectory = $this->engine->getProject()->currentWorkingDirectory.DIRECTORY_SEPARATOR.'.tmp';

        if ($layoutName = $file->getData('layout')) {
            $this->layoutName = (strpos('_templates', $layoutName) === false) ? '_templates'.DIRECTORY_SEPARATOR.$layoutName : $layoutName;
            $this->layoutData = $file->getData();
            $this->engine->getProject()->get('file_layout_cache')->merge([$this->file->getUid() => [$this->layoutName]]);
        }

        try {
            $tmpPathName = $tmpDirectory.DIRECTORY_SEPARATOR.time().'-'.sha1($file->getUid()).'.phtml';

            if (! file_exists($tmpDirectory)) {
                mkdir($tmpDirectory);
            }

            file_put_contents($tmpPathName, $file->getContent());

            $this->data($file->getData());
            $this->data([
                'permalink'     => $file->getCompiledPermalink(),
                'raw_permalink' => $file->getPermalink(),
            ]);

            extract($this->data);

            $level = ob_get_level();
            ob_start();
            include $tmpPathName;
            $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;
        }
    }
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');
        }
    }
1135051
protected function renderTemplateString( $template, array $args = [] )
	{
		foreach( $args as $key => $value ) {
			$template = str_replace( '{'.$key.'}', $value, $template );
		}
		return trim( $template );
	}
462636
public function execute(array $args, array $options = [])
    {
        $template = isset($options['template']) ? $options['template'] : false;
        $template || $template = __DIR__ . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'Controller.php.dist';

        $name = $args[0];
        $name = explode('-', $name);
        if (count($name) < 1) {
            throw new \InvalidArgumentException(sprintf(
                'The arg name "%s" is invalid. eg: adminbase-Blog/Category',
                $name
            ));
        }
        $namespace = str_replace('/', '\\', trim(trim($name[0], '\\/')));

        $path = Cml::getApplicationDir('apps_path') . DIRECTORY_SEPARATOR . $namespace . DIRECTORY_SEPARATOR
            . Cml::getApplicationDir('app_controller_path_name') . DIRECTORY_SEPARATOR;
        $component = explode('/', trim(trim($name[1], '/')));

        if (count($component) > 1) {
            $className = ucfirst(array_pop($component)) . Config::get('controller_suffix');
            $component = implode(DIRECTORY_SEPARATOR, $component);
            $path .= $component . DIRECTORY_SEPARATOR;
            $component = '\\' . $component;
        } else {
            $className = ucfirst($component[0]) . Config::get('controller_suffix');
            $component = '';
        }

        if (!is_dir($path) && false == mkdir($path, 0700, true)) {
            throw new \RuntimeException(sprintf(
                'The path "%s" could not be create',
                $path
            ));
        }

        $contents = strtr(file_get_contents($template), ['$namespace' => $namespace, '$component' => $component, '$className' => $className]);

        $file = $path . $className . '.php';
        if (is_file($file)) {
            throw new \RuntimeException(sprintf(
                'The file "%s" is exist',
                $file
            ));
        }

        if (false === file_put_contents($file, $contents)) {
            throw new \RuntimeException(sprintf(
                'The file "%s" could not be written to',
                $path
            ));
        }

        Output::writeln(Colour::colour('Controller created successfully. ', Colour::GREEN));
    }
914913
public function render(array $context = [])
    {
        if ($template = locate_template($path = $this->getRelativePath(), false, false)) {
            $this->doActions();

            extract(apply_filters("tonik/gin/template/context/{$this->getFilename()}", $context));

            require $template;

            return;
        }

        throw new FileNotFoundException("Template file [{$this->getRelativePath()}] cannot be located.");
    }
1023337
function View_renderFile(templateName, locals, viewsPath) {
            if (!viewsPath) {
                viewsPath = di.getAlias('viewsPath');
            }
            return this.swig.renderFile(viewsPath + templateName, locals);
        }
735164
public function run($args)
	{
		if(is_file($composerAutoload=__DIR__.'/../../vendor/autoload.php'))
			require $composerAutoload;

		$options=array(
			'fileTypes'=>array('php'),
			'exclude'=>array(
				'.gitignore',
				'/yiilite.php',
				'/yiit.php',
				'/cli',
				'/i18n/data',
				'/messages',
				'/vendors',
				'/views',
				'/web/js',
				'/web/widgets/views',
				'/utils/mimeTypes.php',
				'/gii/assets',
				'/gii/components',
				'/gii/controllers',
				'/gii/generators',
				'/gii/models',
				'/gii/views',
			),
		);

		if(!isset($args[0]))
			$this->usageError('the output directory is not specified.');

		if($args[0]=='check') {
			$checkFiles=CFileHelper::findFiles(YII_PATH,$options);
			$model=new ApiModel;
			$model->check($checkFiles);
			exit();
		}

		if(!is_dir($docPath=$args[0]))
			$this->usageError("the output directory {$docPath} does not exist.");

		$offline=true;
		if(isset($args[1]) && $args[1]==='online')
			$offline=false;

		$this->version=Yii::getVersion();

		/*
		 * development version - link to master
		 * release version link to tags
		 */
		if(substr($this->version,-3)=='dev')
			$this->baseSourceUrl .= '/master/framework';
		else
			$this->baseSourceUrl .= '/'.$this->version.'/framework';

		$this->pageTitle='Yii Framework Class Reference';
		$themePath=dirname(__FILE__).'/api';

		echo "\nBuilding.. : " . $this->pageTitle."\n";
		echo "Type...... : " . ( $offline ? "offline" : "online" ). "\n";
		echo "Version... : " . $this->version."\n";
		echo "Source URL : " . $this->baseSourceUrl."\n\n";

		echo "Building model...\n";
		$model=$this->buildModel(YII_PATH,$options);
		$this->classes=$model->classes;
		$this->packages=$model->packages;

		echo "Building pages...\n";
		if($offline)
			$this->buildOfflinePages($docPath.DIRECTORY_SEPARATOR.'api',$themePath);
		else
		{
			$this->buildOnlinePages($docPath.DIRECTORY_SEPARATOR.'api',$themePath);
			$this->buildKeywords($docPath);
			$this->buildPackages($docPath);
		}
		echo "Done.\n\n";
	}
580800
public function renderTemplate($filename, $vars = [], $templateDir = '/templates/')
    {
        $filePath = __DIR__ . $templateDir . $filename;
        if (!file_exists($filePath)) {
            // try with '.php' at the end
            $filePath = $filePath . '.php';
            if (!file_exists($filePath)) {
                throw new \InvalidArgumentException(sprintf('Template "%s" not found in "%s" directory', $filename, __DIR__ . $templateDir));
            }
        }
        $template = new PropelTemplate();
        $template->setTemplateFile($filePath);
        $vars = array_merge($vars, ['behavior' => $this]);

        return $template->render($vars);
    }
397617
public function render($file, $data = [])
    {
        $path = $this->findFile($file);

        $this->config->set('path.found', $path);

        return $this->getEngine()->render($file, $data);
    }
763917
public function renderTwig($file, array $vars = array())
    {
        $page = Page::html();
        if (is_array($file)) {
            $vars = (isset($file['vars']) && is_array($file['vars'])) ? $file['vars'] : array();
            $default = (isset($file['default']) && is_dir($file['default'])) ? rtrim($file['default'], '/').'/' : null;
            $file = (isset($file['file']) && is_string($file['file'])) ? $file['file'] : '';
            if ($default && $template = $this->getFiles($file, $default)) {
                $file = array_pop($template);
            }
        }
        $base = $page->dir['page'];
        $cut = strlen($base);
        if (strpos($file, $this->blog->folder.'themes/') === 0) {
            $dir = $this->blog->folder.'themes/';
            $file = substr($file, strlen($dir));
            $theme = strstr($file, '/', true).'/';
            $dir .= $theme;
            $file = substr($file, strlen($theme));
            $loader = $this->getTwig()->getLoader();
            $loader->addPath($dir, 'theme');
            $dir = substr($dir, $cut);
        } elseif (strpos($file, $base) === 0) {
            $dir = substr(dirname($file).'/', $cut);
            $file = basename($file);
        } else {
            throw new \LogicException("The '{$file}' is not in your website's Page::dir folder.");
        }
        if (!is_file($base.$dir.$file)) {
            throw new \LogicException("The '{$dir}{$file}' file does not exist.");
        }
        if (is_null($this->asset)) { // our first time here
            $this->getTwig()->setParser(new Parser($this->getTwig()));
        }
        $this->asset = array(
            'dir' => $dir,
            'chars' => $page->url['chars'],
        );
        $save = array(
            'template' => $dir.$file,
            'vars' => $vars,
            'start' => microtime(true),
        );
        try {
            $html = $this->getTwig()->render($dir.$file, array_merge($vars, $this->vars));
            $save['output'] = $html;
        } catch (\Exception $e) {
            $html = '<p>'.$e->getMessage().'</p>';
            $save['error'] = $e->getMessage();
        }
        $save['end'] = microtime(true);
        $save['time'] = $save['end'] - $save['start'];
        self::$templates[] = $save;

        return $html;
    }