當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。