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


PHP EngineInterface::render方法代码示例

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


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

示例1: onKernelException

 /**
  * Renders the defined {@see ExceptionListener::$errorTemplate}, which has been defined via YAML
  * settings, on exception.
  *
  * Note, that the function is only called, if the *debug value* is set or *error pages* are
  * enabled via Parameter *stvd.error_page.enabled*.
  *
  * @param GetResponseForExceptionEvent $event
  */
 public function onKernelException(GetResponseForExceptionEvent $event)
 {
     // don't do anything if it's not the master request
     if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
         return;
     }
     // You get the exception object from the received event
     $exception = $event->getException();
     // Customize your response object to display the exception details
     $response = new Response();
     // set response content
     $response->setContent($this->templating->render($this->errorTemplate, array('exception' => $exception)));
     // HttpExceptionInterface is a special type of exception that
     // holds status code and header details
     if ($exception instanceof HttpExceptionInterface) {
         $response->setStatusCode($exception->getStatusCode());
         $response->headers->replace($exception->getHeaders());
     } else {
         // If the exception's status code is not valid, set it to *500*. If it's valid, the
         // status code will be transferred to the response.
         if ($exception->getCode()) {
             $response->setStatusCode($exception->getCode());
         } else {
             $response->setStatusCode(500);
         }
     }
     // Send the modified response object to the event
     $event->setResponse($response);
 }
开发者ID:intermundiasolutions,项目名称:CjwPublishToolsBundle,代码行数:38,代码来源:ExceptionListener.php

示例2: sendResettingEmailMessage

 /**
  * {@inheritDoc}
  */
 public function sendResettingEmailMessage(UserInterface $user)
 {
     $template = $this->parameters['resetting_password.template'];
     $url = $this->router->generate('fos_user_resetting_reset', array('token' => $user->getConfirmationToken()), true);
     $rendered = $this->templating->render($template, array('confirmationUrl' => $url, 'user' => $user));
     $this->sendEmailMessage($rendered, $user->getEmail());
 }
开发者ID:mattvick,项目名称:FOSUserBundleMandrillMailer,代码行数:10,代码来源:FOSUserBundleMailer.php

示例3: onKernelResponse

 public function onKernelResponse(FilterResponseEvent $event)
 {
     return;
     // disabled theming for the time being while it gets refactored.
     if ($event->getRequestType() == HttpKernelInterface::MASTER_REQUEST) {
         $response = $event->getResponse();
         if ($request->isXmlHttpRequest()) {
             return;
         }
         if ($response instanceof RedirectResponse || $response instanceof PlainResponse || $response instanceof AbstractBaseResponse) {
             // dont theme redirects, plain responses or Ajax responses
             return;
         }
         $request = $event->getRequest();
         //            if (!$request->isXmlHttpRequest()
         //                && strpos($response->getContent(), '</body>') === false
         //                && !$response->isRedirection()
         //                && 'html' === $request->getRequestFormat()
         //                && (($response->headers->has('Content-Type') && false !== strpos($response->headers->get('Content-Type'), 'html')) || !$response->headers->has('Content-Type') )) {
         //                $content = $this->templating->render($this->activeTheme.'::master.html.twig', array('maincontent' => $response->getContent()));
         //                $response->setContent('ddd'.$content);
         //            }
         $content = $this->templating->render($this->activeTheme . '::master.html.twig', array('maincontent' => $response->getContent()));
         $response->setContent($content);
     }
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:26,代码来源:ThemeListener.php

示例4: render

 public function render()
 {
     if ($this->templateEngine === null) {
         $this->templateEngine = $this->container->get('templating');
     }
     $menus = $this->container->get('enhavo_app.menu_loader')->getMenu();
     return $this->templateEngine->render($this->template, array('menus' => $menus));
 }
开发者ID:npakai,项目名称:enhavo,代码行数:8,代码来源:AdminMenuRender.php

示例5: writeEntity

 /**
  * @param  object            $entity
  * @param  string            $template
  * @throws \RuntimeException
  */
 public function writeEntity($entity, $template)
 {
     if (!$this->fp) {
         throw new \RuntimeException('Writer is not open');
     }
     $xml = $this->templating->render($template, ['entity' => $entity]);
     fwrite($this->fp, $xml);
 }
开发者ID:mvanduijker,项目名称:FMIoBundle,代码行数:13,代码来源:FeedWriter.php

示例6: generateMail

 /**
  * @param $test
  * @return \Swift_Mime_MimePart
  * @throws \TijsVerkoyen\CssToInlineStyles\Exception
  */
 private function generateMail(Test $test, $template, $to)
 {
     $html = $this->template->render($template, array("test" => $test));
     $css = file_get_contents($this->assetsHelper->getUrl('bundles/corrigeatonmailer/css/main.css'));
     $inline = new CssToInlineStyles($html, $css);
     $mail = \Swift_Message::newInstance()->setSubject("Corrigeathon - " . $test->getName())->setFrom($this->emailSend)->setTo($to)->setBcc("corrigeathon@etud.insa-toulouse.fr")->setBody($inline->convert(), 'text/html');
     return $mail;
 }
开发者ID:livet01,项目名称:corrigeaton,代码行数:13,代码来源:MailerListener.php

示例7: sendContactEmail

 public function sendContactEmail(Messages $message)
 {
     // Envoie un remerciement à l'utilisateur
     $email_contact = \Swift_Message::newInstance()->setSubject('Votre message a bien été reçu !')->setFrom('vleprince123@gmail.com')->setTo($message->getEmail())->setContentType('text/html')->setBody($this->templating->render('default/email.html.twig', array('nom' => $message->getNom(), 'prenom' => $message->getPrenom(), 'email' => $message->getEmail())));
     $this->swiftmailer->send($email_contact);
     // Envoie un message à Gustavo pour le prévenir qu'il vient d'être contacté
     $email_contact = \Swift_Message::newInstance()->setSubject('Gustavo, vous avez reçu un message !')->setTo('vleprince123@gmail.com')->setFrom($message->getEmail())->setContentType('text/html')->setBody($this->templating->render('default/email_contact_gustavo.html.twig', array('message' => $message)));
     $this->swiftmailer->send($email_contact);
 }
开发者ID:Gusgus2015,项目名称:Siteperso,代码行数:9,代码来源:AppMailer.php

示例8: render

 /**
  * {@inheritdoc}
  */
 public function render($object, $format, array $context = [])
 {
     $resolver = new OptionsResolver();
     $this->configureOptions($resolver);
     $params = array_merge($context, ['product' => $object, 'groupedAttributes' => $this->getGroupedAttributes($object, $context['locale']), 'imageAttributes' => $this->getImageAttributes($object, $context['locale'])]);
     $resolver->resolve($params);
     $params['uploadDir'] = $this->uploadDirectory . DIRECTORY_SEPARATOR;
     return $this->pdfBuilder->buildPdfOutput($this->templating->render($this->template, $params));
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:12,代码来源:ProductPdfRenderer.php

示例9: onKernelResponse

 public function onKernelResponse(FilterResponseEvent $event)
 {
     if ($event->getRequestType() == HttpKernelInterface::MASTER_REQUEST) {
         $response = $event->getResponse();
         $request = $event->getRequest();
         if (!$request->isXmlHttpRequest() && strpos($response->getContent(), '</body>') === false && !$response->isRedirection() && 'html' === $request->getRequestFormat() && ($response->headers->has('Content-Type') && false !== strpos($response->headers->get('Content-Type'), 'html') || !$response->headers->has('Content-Type'))) {
             $content = $this->templating->render($this->activeTheme . '::base.html.twig', array('content' => $response->getContent()));
             $response->setContent($content);
         }
     }
 }
开发者ID:planetenkiller,项目名称:core,代码行数:11,代码来源:ThemeListener.php

示例10: notify

 /**
  * Create and send mail notification.
  *
  * @param array $vars Variables to use when rendering mail body.
  * @return MailNotification $this Fluent interface.
  */
 public function notify(array $vars = array())
 {
     $message = \Swift_Message::newInstance()->setSubject($this->settings['subject'])->setFrom($this->settings['from'])->setTo($this->settings['to'])->setCc($this->settings['cc'])->setBcc($this->settings['bcc'])->setBody($this->templateEngine->render($this->settings['template'], $vars), 'text/html');
     try {
         $this->mailer->send($message);
         $this->getLogger()->notice('Mail notification successfully sent.', array_merge($this->settings, array('body' => $message->getBody())));
     } catch (\Exception $e) {
         $this->getLogger()->error('Could not send email notification.', array_merge($this->settings, array('body' => $message->getBody())));
     }
     return $this;
 }
开发者ID:RunOpenCode,项目名称:exchange-rate-bundle,代码行数:17,代码来源:MailNotification.php

示例11: postFormSubmit

 /**
  * This method is called right after the post is stored in the database during the Form submit.
  * It checks whether the form has a notification email set, and if so, it sends out a notification
  * email.
  *
  * @param FormSubmitEvent $event
  */
 public function postFormSubmit(FormSubmitEvent $event)
 {
     $post = $event->getPost();
     $form = $post->getForm();
     if (!$form->getNotificationEmail()) {
         return;
     }
     $body = $this->templating->render('OpiferFormBundle:Email:notification.html.twig', ['post' => $post]);
     $message = \Swift_Message::newInstance()->setSender($this->sender)->setFrom($this->sender)->setTo($form->getNotificationEmail())->setSubject($form->getName())->setBody($body);
     $this->mailer->send($message);
 }
开发者ID:dylanschoenmakers,项目名称:FormBundle,代码行数:18,代码来源:NotificationMailListener.php

示例12: onSuccess

 /**
  * "Success" form handler
  *
  * @param RFPRequest $rfpRequest
  */
 protected function onSuccess(RFPRequest $rfpRequest)
 {
     $status = $this->form->get('status')->getData();
     $noteMessage = trim($this->form->get('note')->getData());
     $rfpRequest->setStatus($status);
     if (!empty($noteMessage)) {
         $note = new Note();
         $note->setTarget($rfpRequest)->setMessage(htmlspecialchars_decode($this->templating->render('OroB2BRFPBundle:Request:note.html.twig', ['status' => $status->getLabel(), 'note' => $noteMessage])));
         $this->manager->persist($note);
     }
     $this->manager->flush();
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:17,代码来源:RequestChangeStatusHandler.php

示例13: searchAction

 /**
  * Search method.
  *
  * @param Request $request Current request to fetch info from.
  *
  * @return Response
  */
 public function searchAction(Request $request)
 {
     $query = $request->get($this->options['query_param_name'], '');
     $page = $request->get($this->options['page_param_name'], 1);
     if (empty($query)) {
         return new Response($this->templating->render($this->options['search_template'], array('query' => '', 'search_results' => array(), 'options' => $this->options['template_options'], 'estimated' => 0)));
     }
     $pager = $this->searchFactory->getPagerfanta($query, $request->getLocale());
     $pager->setCurrentPage($page);
     $results = $pager->getCurrentPageResults();
     return new Response($this->templating->render($this->options['search_template'], array('query' => $query, 'pager' => $pager, 'search_results' => $results, 'estimated' => $pager->getNbResults(), 'options' => $this->options['template_options'])));
 }
开发者ID:frogriotcom,项目名称:LiipSearchBundle,代码行数:19,代码来源:PagedSearchController.php

示例14: onKernelException

 /**
  * Manage kernel exception
  * @param GetResponseForExceptionEvent $event
  *
  * @return GetResponseForExceptionEvent
  */
 public function onKernelException(GetResponseForExceptionEvent $event)
 {
     $exception = $event->getException();
     $response = new Response();
     if ($exception instanceof HttpExceptionInterface) {
         $response->setStatusCode($exception->getStatusCode());
         $response->headers->replace($exception->getHeaders());
     } else {
         $response->setStatusCode(500);
     }
     $content = $this->templating->render('PimEnrichBundle:Error:base.html.twig', ['exception' => $exception, 'status_code' => $response->getStatusCode()]);
     $response->setContent($content);
     $event->setResponse($response);
 }
开发者ID:umpirsky,项目名称:pim-community-dev,代码行数:20,代码来源:KernelExceptionListener.php

示例15: renderJsTranslationContent

 /**
  * Combines JSON with js translation and renders js-resource
  *
  * @param array $domains
  * @param string $locale
  * @param bool $debug
  * @return string
  */
 public function renderJsTranslationContent(array $domains, $locale, $debug = false)
 {
     $domainsTranslations = $this->translator->getTranslations($domains, $locale);
     $result = ['locale' => $locale, 'defaultDomains' => $domains, 'messages' => []];
     if ($debug) {
         $result['debug'] = true;
     }
     foreach ($domainsTranslations as $domain => $translations) {
         $result['messages'] += array_combine(array_map(function ($id) use($domain) {
             return sprintf('%s:%s', $domain, $id);
         }, array_keys($translations)), array_values($translations));
     }
     return $this->templating->render($this->template, ['json' => $result]);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:22,代码来源:Controller.php


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