Создать шаблон Plates

@return Template
327360
public function template($name, $data = null)
  {
    $t = $this->getTemplatesEngine()->make($name);

    if ($data) {
      $t->data($data);
    }

    return $t;
  }
1302109
public function sectionTemplatesEdit()
	{
		$templates = Templates::getInstance();
		$item = $templates->get(arg('id'), '', true);
		$form = array(
			'name' => 'editForm',
			'caption' => Eresus_Kernel::app()->getPage()->title.ADM_T_DIV.ADM_EDIT,
			'width' => '100%',
			'fields' => array (
				array('type'=>'hidden','name'=>'action', 'value'=>'update'),
				array('type'=>'hidden','name'=>'section', 'value'=>arg('section')),
				array('type'=>'hidden','name'=>'name'),
				array('type' => 'edit', 'name' => 'filename', 'label' => ADM_THEMES_FILENAME_LABEL,
					'width' => '200px', 'comment' => '.html', 'disabled' => true, 'value' => $item['name']),
				array('type'=>'edit','name'=>'desc','label'=>ADM_THEMES_DESC_LABEL, 'width'=>'100%'),
				array('type'=>'memo','name'=>'code', 'height'=>'30', 'syntax' => 'html'),
			),
			'buttons' => array('ok', 'apply', 'cancel'),
		);
		/** @var TAdminUI $page */
		$page = Eresus_Kernel::app()->getPage();
		$result = $page->renderForm($form, $item);
		return $result;
	}
892692
protected function template()
    {
        $template = $this->template ?: $this->config->get('datatables-html.script', 'datatables::script');

        return $this->view->make($template, ['editors' => $this->editors])->render();
    }
758631
protected function buildTemplate()
    {
        $this->t_wrap->del('rows');
        $this->t_wrap->appendHTML('rows', '{rows}');

        for ($row = 1; $row <= $this->rows; $row++) {
            $this->t_row->del('column');

            for ($col = 1; $col <= $this->columns; $col++) {
                $this->t_col->set('Content', '{$r'.$row.'c'.$col.'}');

                $this->t_row->appendHTML('column', $this->t_col->render());
            }

            $this->t_wrap->appendHTML('rows', $this->t_row->render());
        }
        $this->t_wrap->appendHTML('rows', '{/rows}');
        $tmp = new Template($this->t_wrap->render());

        $this->template->template['rows#1'] = $tmp->template['rows#1'];

        $this->template->rebuildTags();
        $this->addClass($this->words[$this->columns].' column');
    }
550511
private function getTemplateDirectory()
    {
        $templateDirectory = realpath($this->templateDirectory . '/_template');

        if ($this->files->exists($templateDirectory) && $this->files->isDirectory($templateDirectory)) {
            $this->generator->setInsideTemplateDirectory(true);

            return $templateDirectory;
        }

        return $this->templateDirectory;
    }
853710
private function getTemplates()
	{
		if (is_null($this->templates))
		{
			useLib('templates');
			$this->templates = new Templates();
		}

		return $this->templates;
	}
10077
public function getTemplates()
    {
        $templates = array();

        if ($handle = opendir(Primer::$PATTERN_PATH . '/templates')) {
            while (false !== ($entry = readdir($handle))) {
                if (substr($entry, 0, 1) !== '.') {
                    $templates[] = array(
                        'id' => $entry,
                        'title' => preg_replace('/[^A-Za-z0-9]/', ' ', $entry),
                    );
                }
            }

            closedir($handle);
        }

        return $templates;
    }
353587
public function getDefaultTemplate()
    {
        list($default, $negated) = $this->getTemplateStrings();

        $template = new ArrayTemplate([
            'default' => $default,
            'negated' => $negated,
        ]);

        return $template->setTemplateVars([
            'key' => $this->getKey(),
            'value' => $this->getValue(),
            'actualValue' => $this->getActualValue(),
        ]);
    }
389194
public function buildTemplate()
    {
        if (!empty($this->template)) {
            return $this->template;
        }

        $actions = [];
        foreach ($this->actionBuilders as $actionBuilder) {
            $actions[] = $actionBuilder->buildTemplateAction();
        }

        $this->template = [
            'type' => TemplateType::CONFIRM,
            'text' => $this->text,
            'actions' => $actions,
        ];

        return $this->template;
    }
1339528
public function TemplateFile()
    {
        if (!$this->AllowCustomTemplates() ||
                !$this->content || !$this->content->GetTemplate())
        {
            return $this->BuiltInTemplateFile();
        }
        $file = Path::Combine(PathUtil::ModuleCustomTemplatesFolder($this), $this->content->GetTemplate());
        return Path::AddExtension($file, 'phtml');
    }
158224
public function listTemplateNames()
    {
        $this->setUpTemplate();
        $ret = array();
        foreach ($this->templates as $key => $val) {
            $ret[] = $key;
        }
        return $ret;
    }
513158
public function templatesListAction()
	{
		$localeId = $this->getCurrentLocale()
				->getId();

		$templateLocalizations = $this->getEntityManager()
				->getRepository(TemplateLocalization::CN())
				->findBy(array('locale' => $localeId), array('title' => 'asc'));

		/* @var $templateLocalizations TemplateLocalization[] */

		$responseData = array();

		foreach ($templateLocalizations as $templateLocalization) {
			$responseData[] = array(
				'id'		=> $templateLocalization->getMaster()->getId(),
				'title'		=> $templateLocalization->getTitle(),
			);
		}

		return new SupraJsonResponse($responseData);
	}
650967
private function primeTemplate() {

		// unroll Loops {loop $counter} .. {end_loop}

		$this->template = $this->doLoop($this->template);

		// insert vars and loop counters

		$this->template = $this->doInsertVars($this->template);

		// {if (cond)} .. {else} .. {end_if}

		$this->template = $this->doIfElseEndif($this->template);

		// insert misc html
		foreach($this->miscHtml as $k => $v) {
			if(!is_array($v)) {
				$this->template = preg_replace("/\{html:$k\}/i", $v, $this->template);
			}
			else {
				foreach($v as $vv) {
					$this->template = preg_replace("/\{html:$k\}/i", $vv, $this->template, 1);
				}
			}
		}
		
		return $this;
	}
960394
public function getTemplateEngine()
    {
        if (null == $this->templateEngine) {
            Template::addPath(dirname(dirname(__DIR__)).'/templates');
            $template = (new Template())->initialize();
            $this->setTemplateEngine($template);
        }
        return $this->templateEngine;
    }
737226
public function getHomeTemplate()
    {
        $templateName = 'home';
        if ( ! $this->hasTemplate($templateName)) {

            // Returns the first one in alphabetic order
            $templates = array_keys($this->templates);
            sort($templates);
            $templateName = $templates[0];
        }
        
        return $this->templates[$templateName];
    }
1349173
public function getTemplate()
    {
        if (is_null($this->_template)) {
            Template::appendPath(dirname(__FILE__).'/Views');
            $temp = new Template();
            $this->_template = $temp->initialize();
        }
        return $this->_template;
    }
971868
public function getTemplate()
    {
        if(!$this->__template instanceof KTemplateInterface)
        {
            if(empty($this->__template) || (is_string($this->__template) && strpos($this->__template, '.') === false) )
            {
                $identifier         = $this->getIdentifier()->toArray();
                $identifier['path'] = array('template');
                $identifier['name'] = $this->__template;
            }
            else $identifier = $this->getIdentifier($this->__template);

            $this->__template = $this->getObject($identifier);
        }

        return $this->__template;
    }