本文整理汇总了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);
}
示例2: createTemplate
/**
* @return Template
*/
protected function createTemplate()
{
/** @var Template $template */
$template = parent::createTemplate();
$template->getLatte()->addFilter('base', callback($this->helpers, 'loader'));
return $template;
}
示例3: createTemplate
protected function createTemplate($class = NULL)
{
$template = parent::createTemplate($class);
$translator = $this->getPresenter()->getService('translator');
$template->setTranslator($translator);
return $template;
}
示例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;
}
示例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;
}
示例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('>>> ' . $servise->texty["viac"]) . '<div class="ostatok">' . $rozloz[1] . '</div>';
}
return $vysledok;
});
return $template;
}
示例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;
}
示例8: createTemplate
/**
* @return ITemplate
*/
public function createTemplate()
{
$template = parent::createTemplate();
/** @noinspection PhpUndefinedMethodInspection */
$template->setTranslator($this->translator);
return $template;
}
示例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;
}
示例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;
}
示例11: createTemplate
/**
* @return ITemplate
*/
protected function createTemplate()
{
$template = parent::createTemplate();
if ($template instanceof Template) {
$template->setTranslator($this->translator);
}
return $template;
}
示例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;
}
示例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('>>> ' . $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;
}
示例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;
}
示例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;
}