当前位置: 首页>>代码示例>>PHP>>正文


PHP Control::createTemplate方法代码示例

本文整理汇总了PHP中Nette\Application\UI\Control::createTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP Control::createTemplate方法的具体用法?PHP Control::createTemplate怎么用?PHP Control::createTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Application\UI\Control的用法示例。


在下文中一共展示了Control::createTemplate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createTemplate

 protected function createTemplate($class = NULL)
 {
     if (!is_null($this->templateFactory)) {
         return $this->templateFactory->createTemplate($this->getPresenter());
     }
     return parent::createTemplate($class);
 }
开发者ID:RiKap,项目名称:ErrorMonitoring,代码行数:7,代码来源:FactoryBaseControl.php

示例2: createTemplate

 /**
  * @return Template
  */
 protected function createTemplate()
 {
     /** @var Template $template */
     $template = parent::createTemplate();
     $template->getLatte()->addFilter('base', callback($this->helpers, 'loader'));
     return $template;
 }
开发者ID:pecinaon,项目名称:sandbox,代码行数:10,代码来源:Control.php

示例3: createTemplate

 protected function createTemplate($class = NULL)
 {
     $template = parent::createTemplate($class);
     $translator = $this->getPresenter()->getService('translator');
     $template->setTranslator($translator);
     return $template;
 }
开发者ID:bazo,项目名称:Tatami,代码行数:7,代码来源:BaseControl.php

示例4: createTemplate

 /**
  * @param string $class
  * @return \Nette\Templating\FileTemplate
  * @internal
  */
 public function createTemplate($class = NULL)
 {
     $template = parent::createTemplate($class);
     $template->setFile(__DIR__ . '/DateRangePicker.latte');
     //$template->registerHelper('translate', callback($this->getTranslator(), 'translate'));
     return $template;
 }
开发者ID:mepatek,项目名称:daterangepicker,代码行数:12,代码来源:DateRangePicker.php

示例5: createTemplate

 protected function createTemplate($class = NULL)
 {
     $template = parent::createTemplate($class);
     $texy = new \Texy();
     $texy->encoding = 'utf-8';
     $texy->setOutputMode(\Texy::HTML5);
     // config as in \TexyConfigurator::safeMode($texy);
     $safeTags = array('a' => array('href', 'title'), 'acronym' => array('title'), 'b' => array(), 'br' => array(), 'cite' => array(), 'code' => array(), 'em' => array(), 'i' => array(), 'strong' => array(), 'sub' => array(), 'sup' => array(), 'q' => array(), 'small' => array());
     $texy->allowedClasses = \Texy::NONE;
     // no class or ID are allowed
     $texy->allowedStyles = \Texy::NONE;
     // style modifiers are disabled
     $texy->allowedTags = $safeTags;
     // only some "safe" HTML tags and attributes are allowed
     $texy->urlSchemeFilters[\Texy::FILTER_ANCHOR] = '#https?:|ftp:|mailto:#A';
     $texy->urlSchemeFilters[\Texy::FILTER_IMAGE] = '#https?:#A';
     $texy->allowed['image'] = FALSE;
     // disable images
     $texy->allowed['link/definition'] = FALSE;
     // disable [ref]: URL  reference definitions
     $texy->allowed['html/comment'] = FALSE;
     // disable HTML comments
     # zakázaní nadpisů
     $texy->allowed['heading/surrounded'] = FALSE;
     $texy->allowed['heading/underlined'] = FALSE;
     # zalamování textu v odstavcích po enteru
     # false => nebude spojovat řádky, vloží místo enteru <br>
     # true => řádky po jednom enteru spojí
     $texy->mergeLines = false;
     $texy->linkModule->forceNoFollow = TRUE;
     // force rel="nofollow"
     $template->registerHelper('texy', callback($texy, 'process'));
     return $template;
 }
开发者ID:BroukPytlik,项目名称:agility,代码行数:34,代码来源:itemList.php

示例6: createTemplate

 protected function createTemplate($class = NULL)
 {
     $servise = $this;
     $template = parent::createTemplate($class);
     $template->addFilter('obr_v_txt', function ($text) use($servise) {
         $rozloz = explode("#", $text);
         $serv = $servise->presenter;
         $vysledok = '';
         $cesta = 'http://' . $serv->nazov_stranky . "/";
         foreach ($rozloz as $k => $cast) {
             if (substr($cast, 0, 2) == "I-") {
                 $obr = $serv->dokumenty->find((int) substr($cast, 2));
                 if ($obr !== FALSE) {
                     $cast = \Nette\Utils\Html::el('a class="fotky" rel="fotky"')->href($cesta . $obr->subor)->title($obr->nazov)->setHtml(\Nette\Utils\Html::el('img')->src($cesta . $obr->thumb)->alt($obr->nazov));
                 }
             }
             $vysledok .= $cast;
         }
         return $vysledok;
     });
     $template->addFilter('koncova_znacka', function ($text) use($servise) {
         $rozloz = explode("{end}", $text);
         $vysledok = $text;
         if (count($rozloz) > 1) {
             //Ak som nasiel znacku
             $vysledok = $rozloz[0] . \Nette\Utils\Html::el('a class="cely_clanok"')->href($servise->link("this"))->title($servise->texty["title"])->setHtml('&gt;&gt;&gt; ' . $servise->texty["viac"]) . '<div class="ostatok">' . $rozloz[1] . '</div>';
         }
         return $vysledok;
     });
     return $template;
 }
开发者ID:petak23,项目名称:echo-msz,代码行数:31,代码来源:Aktualne.php

示例7: createTemplate

	/**
	 * Automatically registers template file.
	 *
	 * @author   Jan Tvrdík
	 * @param    string
	 * @return   Nette\Templating\FileTemplate
	 */
	protected function createTemplate($class = NULL)
	{
		$template = parent::createTemplate($class);
		if ($this->autoSetupTemplateFile) $template->setFile($this->getTemplateFilePath());

		return $template;
	}
开发者ID:JanTvrdik,项目名称:NetteExtras,代码行数:14,代码来源:BaseControl.php

示例8: createTemplate

 /**
  * @return ITemplate
  */
 public function createTemplate()
 {
     $template = parent::createTemplate();
     /** @noinspection PhpUndefinedMethodInspection */
     $template->setTranslator($this->translator);
     return $template;
 }
开发者ID:kizi,项目名称:easyminer-easyminercenter,代码行数:10,代码来源:MailerControl.php

示例9: createTemplate

	/**
	 * @return Nette\Templating\ITemplate
	 */
	protected function createTemplate($class = NULL)
	{
		$template = parent::createTemplate($class);
		if ($this->getContext()->hasService('translator')) {
			$template->setTranslator($this->getContext()->translator);
		}
		return $template;
	}
开发者ID:norbe,项目名称:framework,代码行数:11,代码来源:Control.php

示例10: createTemplate

 public function createTemplate($class = NULL)
 {
     $template = parent::createTemplate($class);
     $template->setTranslator($this->parent->translator);
     // $translator in presenter has to be public
     // or $this->translator via construct/inject
     return $template;
 }
开发者ID:soundake,项目名称:pd,代码行数:8,代码来源:FlagsControl.php

示例11: createTemplate

 /**
  * @return ITemplate
  */
 protected function createTemplate()
 {
     $template = parent::createTemplate();
     if ($template instanceof Template) {
         $template->setTranslator($this->translator);
     }
     return $template;
 }
开发者ID:shophp,项目名称:shophp,代码行数:11,代码来源:BaseControl.php

示例12: createTemplate

 /**
  * @param string|null $class
  * @return \Nette\Templating\FileTemplate
  */
 protected function createTemplate($class = null)
 {
     /** @var FileTemplate $template */
     $template = parent::createTemplate($class);
     $class = $this->getReflection();
     $file = dirname($class->getFileName()) . '/' . $class->getShortName() . '.latte';
     $template->setFile($file);
     return $template;
 }
开发者ID:leonardoca,项目名称:nbootstrap,代码行数:13,代码来源:Alerts.php

示例13: createTemplate

 protected function createTemplate($class = NULL)
 {
     $servise = $this;
     $template = parent::createTemplate($class);
     $template->addFilter('obr_v_txt', function ($text) use($servise) {
         $rozloz = explode("#", $text);
         $serv = $servise->presenter;
         $vysledok = '';
         $cesta = 'http://' . $serv->nazov_stranky . "/";
         foreach ($rozloz as $k => $cast) {
             if (substr($cast, 0, 2) == "I-") {
                 $obr = $serv->dokumenty->find((int) substr($cast, 2));
                 if ($obr !== FALSE) {
                     $cast = \Nette\Utils\Html::el('a class="fotky" rel="fotky"')->href($cesta . $obr->subor)->title($obr->nazov)->setHtml(\Nette\Utils\Html::el('img')->src($cesta . $obr->thumb)->alt($obr->nazov));
                 }
             }
             $vysledok .= $cast;
         }
         return $vysledok;
     });
     $template->addFilter('koncova_znacka', function ($text) use($servise) {
         $rozloz = explode("{end}", $text);
         $vysledok = $text;
         if (count($rozloz) > 1) {
             //Ak som nasiel znacku
             $vysledok = $rozloz[0] . \Nette\Utils\Html::el('a class="cely_clanok"')->href($servise->link("this"))->title($servise->texty["title"])->setHtml('&gt;&gt;&gt; ' . $servise->texty["viac"]) . '<div class="ostatok">' . $rozloz[1] . '</div>';
         }
         return $vysledok;
     });
     $template->addFilter('textreg', function ($text, $id_registracia, $max_id_reg) {
         for ($i = $max_id_reg; $i >= 0; $i--) {
             $znacka_zac = "#REG" . $i . "#";
             //Pociatocna znacka
             $znacka_kon = "#/REG" . $i . "#";
             //Koncova znacka
             $poloha = strpos($text, $znacka_zac);
             //Nájdem pociatocnu znacku
             if (!($poloha === false)) {
                 //Ak som našiel
                 $poloha_kon = strpos($text, $znacka_kon);
                 //Nájdem koncovu znacku
                 if (!($poloha_kon === false)) {
                     //Ak som našiel
                     if ($i > $id_registracia) {
                         //Som nad mojou dovolenou urovnou
                         $text = substr($text, 0, $poloha) . substr($text, $poloha_kon + strlen($znacka_kon));
                     } else {
                         //Vypusť pociatocnu a koncovu znacku
                         $text = substr($text, 0, $poloha) . substr($text, $poloha + strlen($znacka_zac), $poloha_kon - $poloha - strlen($znacka_zac)) . substr($text, $poloha_kon + strlen($znacka_kon));
                     }
                 }
             }
         }
         return $text;
     });
     return $template;
 }
开发者ID:petak23,项目名称:echo-msz,代码行数:57,代码来源:Aktualne.php

示例14: createTemplate

 /**
  * Register a helper method with the template
  * 
  * @param  string|NULL  $class
  * @return Nette\Templating\ITemplate
  */
 protected function createTemplate($class = null)
 {
     $template = parent::createTemplate($class);
     $template->registerHelper('monthToStr', function ($month) {
         $monthsMap = array(1 => 'January', 2 => 'February', 3 => 'March', 4 => 'April', 5 => 'May', 6 => 'June', 7 => 'July', 8 => 'August', 9 => 'September', 10 => 'October', 11 => 'November', 12 => 'December');
         return $monthsMap[$month];
     });
     return $template;
 }
开发者ID:dansilovsky,项目名称:calendar,代码行数:15,代码来源:MonthControl.php

示例15: createTemplate

 protected function createTemplate($class = NULL)
 {
     $template = parent::createTemplate($class);
     $template->registerHelperLoader('Helpers::loader');
     $this->translator = \Nette\Environment::getContext()->translator;
     $template->setTranslator($this->translator);
     $template->registerHelper('convert', callback(\Nette\Environment::getContext()->currencyHelper, 'convert'));
     $template->currentLang = $this->translator->getLangTo();
     return $template;
 }
开发者ID:RiKap,项目名称:ErrorMonitoring,代码行数:10,代码来源:BaseControl.php


注:本文中的Nette\Application\UI\Control::createTemplate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。