当前位置: 首页>>代码示例>>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;未经允许,请勿转载。