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


PHP Service::getTemplateEngine方法代码示例

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


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

示例1: prepareTwig

 protected function prepareTwig()
 {
     $groups = Group::getGroups($this->getMe()->getId());
     Service::getTemplateEngine()->addGlobal("groups", $groups);
     $creator = new MessageSearchFormCreator();
     $searchForm = $creator->create();
     Service::getTemplateEngine()->addGlobal("searchForm", $searchForm->createView());
 }
开发者ID:kleitz,项目名称:bzion,代码行数:8,代码来源:MessageController.php

示例2: addTwigGlobals

 /**
  * Prepare the twig global variables
  */
 private function addTwigGlobals()
 {
     if ($this->twigReady) {
         return;
     }
     $request = $this->getRequest();
     // Add global variables to the twig templates
     $twig = Service::getTemplateEngine();
     $twig->addGlobal("me", $this->getMe());
     $twig->addGlobal("model", new ModelFetcher());
     $twig->addGlobal("request", $request);
     $twig->addGlobal("session", $request->getSession());
     $twig->addGlobal("app", new AppGlobal($this->parent, $this->container));
     $this->prepareTwig();
     $this->twigReady = true;
 }
开发者ID:bchhun,项目名称:bzion,代码行数:19,代码来源:HTMLController.php

示例3: render

 /**
  * Renders a view
  * @param  string $view       The view name
  * @param  array  $parameters An array of parameters to pass to the view
  * @return string The rendered view
  */
 protected function render($view, $parameters = array())
 {
     Debug::startStopwatch('view.render');
     $template = Service::getTemplateEngine();
     $ret = $template->render($view, $parameters);
     Debug::finishStopwatch('view.render');
     return $ret;
 }
开发者ID:bchhun,项目名称:bzion,代码行数:14,代码来源:Controller.php

示例4: emailNotification

 /**
  * Notify the user about a notification by e-
  * @param \Notification $notification The notification that will be mailed
  */
 public function emailNotification(\Notification $notification)
 {
     $text = \Service::getTemplateEngine()->render('Notification/item.html.twig', array('notification' => $notification));
     return $this->sendEmails(trim(strip_tags($text)), array($notification->getReceiver()->getId()), 'notification', array('notification' => $notification, 'text' => $text));
 }
开发者ID:kleitz,项目名称:bzion,代码行数:9,代码来源:EventSubscriber.php


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