當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Presenter::createTemplate方法代碼示例

本文整理匯總了PHP中Nette\Application\UI\Presenter::createTemplate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Presenter::createTemplate方法的具體用法?PHP Presenter::createTemplate怎麽用?PHP Presenter::createTemplate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Nette\Application\UI\Presenter的用法示例。


在下文中一共展示了Presenter::createTemplate方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createTemplate

 /**
  * @param string $class
  * @return \Nette\Templating\ITemplate
  */
 protected function createTemplate($class = NULL)
 {
     /** @var \Nette\Templating\FileTemplate|\stdClass $template */
     $template = parent::createTemplate($class);
     $template->registerHelperLoader(callback($this->presenter->context->getByType('Ale\\TemplateHelpers'), "loader"));
     return $template;
 }
開發者ID:frosty22,項目名稱:ale,代碼行數:11,代碼來源:Presenter.php

示例2: createTemplate

 /**
  * @param null $class
  * @return \Nette\Templating\ITemplate
  */
 protected function createTemplate($class = NULL)
 {
     $template = parent::createTemplate($class);
     $template->setTranslator($this->translator);
     $template->registerHelperLoader(callback($this->helpers, 'loader'));
     return $template;
 }
開發者ID:peterzadori,項目名稱:movi,代碼行數:11,代碼來源:Presenter.php

示例3: createTemplate

 /**
  * @return \Nette\Bridges\ApplicationLatte\Template
  */
 protected function createTemplate()
 {
     /** @var \Nette\Bridges\ApplicationLatte\Template $template */
     $template = parent::createTemplate();
     $this->latteFilters->install($template->getLatte());
     return $template;
 }
開發者ID:milo,項目名稱:web-project,代碼行數:10,代碼來源:BasePresenter.php

示例4: createTemplate

 /**
  *
  *
  * @param null $class
  *
  * @return mixed
  */
 protected function createTemplate($class = NULL)
 {
     $template = parent::createTemplate($class);
     $template->addFilter('format', function ($number) {
         return number_format($number, 0, ',', ' ');
     });
     return $template;
 }
開發者ID:jan-burianek,項目名稱:mfcr-spending-data,代碼行數:15,代碼來源:BasePresenter.php

示例5: createTemplate

 protected function createTemplate($class = NULL)
 {
     $template = parent::createTemplate();
     $latte = $template->getLatte();
     $set = new \Latte\Macros\MacroSet($latte->getCompiler());
     $set->addMacro('scache', '?>?<?php echo strtotime(date(\'Y-m-d hh \')); ?>"<?php');
     $latte->addFilter('scache', $set);
     return $template;
 }
開發者ID:o5,項目名稱:grido-examples,代碼行數:9,代碼來源:Presenter.php

示例6: createTemplate

 /**
  * @param string $class
  * @return \Nette\Templating\ITemplate
  */
 protected function createTemplate($class = NULL)
 {
     /** @var \Nette\Templating\FileTemplate|\stdClass $template */
     $template = parent::createTemplate($class);
     $template->registerHelper('mtime', function ($f) {
         return $f . '?v=' . filemtime($this->context->parameters['wwwDir'] . '/' . $f);
     });
     return $template;
 }
開發者ID:lohini,項目名稱:framework,代碼行數:13,代碼來源:Presenter.php

示例7: createTemplate

 protected function createTemplate($class = NULL)
 {
     $template = parent::createTemplate($class);
     $template->addFilter(NULL, '\\Filters::common');
     // Add mobile detect and its helper to template
     $template->_mobileDetect = $this->mobileDetect;
     $template->_deviceView = $this->deviceView;
     return $template;
 }
開發者ID:caloriscz,項目名稱:caloriscms,代碼行數:9,代碼來源:BasePresenter.php

示例8: createTemplate

 /**
  * @param string|NULL
  * @return \Nette\Templating\ITemplate
  */
 public function createTemplate($class = NULL)
 {
     $template = parent::createTemplate();
     $template->registerHelperLoader($this->helperLoader);
     if (isset($this->context->getParameters()['googleAnalyticsCode'])) {
         $template->googleAnalyticsCode = $this->context->getParameters()['googleAnalyticsCode'];
     }
     return $template;
 }
開發者ID:newPOPE,項目名稱:web-addons.nette.org,代碼行數:13,代碼來源:BasePresenter.php

示例9: createTemplate

 /**
  * @return UI\ITemplate
  */
 protected function createTemplate()
 {
     /** @var Nette\Bridges\ApplicationLatte\Template $template */
     $template = parent::createTemplate();
     $latte = $template->getLatte();
     $latte->addFilter('texy', function ($input) {
         $texy = $this->prepareTexy();
         $html = new Nette\Utils\Html();
         return $html::el()->setHtml($texy->process($input));
     });
     $latte->addFilter('vlna', function ($string) {
         $string = preg_replace('<([^a-zA-Z0-9])([ksvzaiou])\\s([a-zA-Z0-9]{1,})>i', "\$1\$2 \$3", $string);
         //&nbsp; === \xc2\xa0
         return $string;
     });
     $latte->addFilter('dateInWords', function ($time) {
         $time = Nette\Utils\DateTime::from($time);
         $months = [1 => 'leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'];
         return $time->format('j. ') . $months[$time->format('n')] . $time->format(' Y');
     });
     $latte->addFilter('timeAgoInWords', function ($time) {
         $time = Nette\Utils\DateTime::from($time);
         $delta = round((time() - $time->getTimestamp()) / 60);
         if ($delta == 0) {
             return 'před okamžikem';
         }
         if ($delta == 1) {
             return 'před minutou';
         }
         if ($delta < 45) {
             return "před {$delta} minutami";
         }
         if ($delta < 90) {
             return 'před hodinou';
         }
         if ($delta < 1440) {
             return 'před ' . round($delta / 60) . ' hodinami';
         }
         if ($delta < 2880) {
             return 'včera';
         }
         if ($delta < 43200) {
             return 'před ' . round($delta / 1440) . ' dny';
         }
         if ($delta < 86400) {
             return 'před měsícem';
         }
         if ($delta < 525960) {
             return 'před ' . round($delta / 43200) . ' měsíci';
         }
         if ($delta < 1051920) {
             return 'před rokem';
         }
         return 'před ' . round($delta / 525960) . ' lety';
     });
     return $template;
 }
開發者ID:mrtnzlml,項目名稱:zlml.cz,代碼行數:60,代碼來源:BasePresenter.php

示例10: createTemplate

 /**
  * @param string|NULL
  * @return \Nette\Templating\ITemplate
  */
 public function createTemplate($class = NULL)
 {
     /** @var \Nette\Bridges\ApplicationLatte\Template $template */
     $template = parent::createTemplate();
     $this->helperLoader->load($template->getLatte());
     if (isset($this->context->getParameters()['googleAnalyticsCode'])) {
         $template->googleAnalyticsCode = $this->context->getParameters()['googleAnalyticsCode'];
     }
     return $template;
 }
開發者ID:nette,項目名稱:web-addons.nette.org,代碼行數:14,代碼來源:BasePresenter.php

示例11: createTemplate

 /**
  * @return Template
  * @throws InvalidStateException
  */
 protected function createTemplate()
 {
     /** @var Template $template */
     $template = parent::createTemplate();
     if ($this->helpers === NULL) {
         throw new InvalidStateException('Please register presenter in config as Service, for autowiring dependencies!, ' . $this->getReflection()->getName());
     }
     $template->getLatte()->addFilter('base', callback($this->helpers, 'loader'));
     return $template;
 }
開發者ID:pecinaon,項目名稱:sandbox,代碼行數:14,代碼來源:Presenter.php

示例12: createTemplate

 /**
  * @return ITemplate
  */
 protected function createTemplate()
 {
     $template = parent::createTemplate();
     if ($template instanceof Template) {
         $template->setTranslator($this->translator);
         $template->addFilter(null, function ($filter, ...$args) {
             if (method_exists($this->templateFilters, $filter)) {
                 return $this->templateFilters->{$filter}(...$args);
             }
             return null;
         });
     }
     return $template;
 }
開發者ID:shophp,項目名稱:shophp,代碼行數:17,代碼來源:BasePresenter.php

示例13: createTemplate

 public function createTemplate($class = NULL)
 {
     // pokud není nastaven, použijeme defaultní z configu
     if (!isset($this->lang)) {
         $this->lang = $this->context->parameters["lang"];
     }
     if ($this->lang == "cs") {
         setlocale(LC_ALL, 'cs_CZ.UTF-8');
     }
     $template = parent::createTemplate($class);
     $template->setTranslator($this->translator);
     $helpers = $this->context->myTemplateHelpers;
     $template->registerHelperLoader(array($helpers, 'loader'));
     $template->lang = $this->lang;
     return $template;
 }
開發者ID:soundake,項目名稱:pd,代碼行數:16,代碼來源:BasePresenter.php

示例14: createTemplate

 /**
  *
  * @param string|NULL $class
  * @return Nette\Application\UI\ITemplate
  */
 protected function createTemplate($class = NULL)
 {
     $template = parent::createTemplate($class);
     $template->_gravatar = $this->gravatar;
     $this->translator->createTemplateHelpers()->register($template->getLatte());
     return $template;
 }
開發者ID:cothema,項目名稱:cmsbe,代碼行數:12,代碼來源:BasePresenter.php

示例15: createTemplate

 /**
  * Adds new helpers into the templates
  * {@inheritdoc}
  */
 protected function createTemplate($class = NULL)
 {
     $template = parent::createTemplate($class);
     $template->registerHelperLoader('Helpers::loader');
     return $template;
 }
開發者ID:patrickkusebauch,項目名稱:27skauti,代碼行數:10,代碼來源:BasePresenter.php


注:本文中的Nette\Application\UI\Presenter::createTemplate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。