當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Renderer::setTemplate方法代碼示例

本文整理匯總了PHP中Renderer::setTemplate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Renderer::setTemplate方法的具體用法?PHP Renderer::setTemplate怎麽用?PHP Renderer::setTemplate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Renderer的用法示例。


在下文中一共展示了Renderer::setTemplate方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _render

 /**
  * Render request
  *
  * @param array       $data
  * @param string|null $template
  * @param string|null $blockClass
  * @return $this
  */
 protected function _render(array $data = array(), $template = null, $blockClass = null)
 {
     //create block
     if ($blockClass) {
         $blockClass = '\\App\\Block' . '\\' . $blockClass;
         $block = new $blockClass($data);
     } else {
         $block = new Renderer($data);
     }
     if (!$template) {
         //set template
         $template = $this->getControllerName() . DIRECTORY_SEPARATOR . $this->getActionName() . '.phtml';
     }
     $block->setTemplate($template);
     //get action HTML
     $actionHtml = $block->toHtml();
     if (!$this->isAjax()) {
         $block = new Renderer(array('content' => $actionHtml));
         $block->setTemplate('index.phtml');
         //add system messages block
         $message = new Message();
         $message->setTemplate('index/messages.phtml');
         $block->setChild('message', $message);
         echo $block->toHtml();
     } else {
         echo $actionHtml;
     }
     return $this;
 }
開發者ID:andkirby,項目名稱:commithook,代碼行數:37,代碼來源:TestClassSplit.php

示例2: execute

 function execute(&$controller, &$request, &$user)
 {
     $renderer = new Renderer();
     $renderer->setTemplate("Index.php");
     $renderer->setAttribute("configs", $request->getAttribute("configs"));
     $renderer->setAttribute("modules", $request->getAttribute("modules"));
     $renderer->setAttribute("globalFilterList", $request->getAttribute("globalFilterList"));
     $renderer->setAttribute("authorizationHandler", $request->getAttribute("authorizationHandler"));
     $renderer->setAttribute("user", $request->getAttribute("user"));
     $renderer->setAttribute("userContainer", $request->getAttribute("userContainer"));
     $renderer->setAttribute("sessionHandler", $request->getAttribute("sessionHandler"));
     $renderer->setAttribute("loggers", $request->getAttribute("loggers"));
     return $renderer;
 }
開發者ID:komagata,項目名稱:plnet,代碼行數:14,代碼來源:IndexView_index.class.php

示例3: getMailContent

 /**
  * Function generates password recovery email message content
  * May be used in the following way:
  * <pre>
  * $this->getMailContent(array(
  *     'user_name'=>'John Doe',
  *     'link'=>$this->getPasswordRecoveryLink($user)
  * ));
  * </pre>
  * 
  * @author Aleh Hutnikau <hutnikau@1pt.com>
  * @param array $messageData
  * @return string Message content
  */
 private function getMailContent($messageData)
 {
     $renderer = new \Renderer();
     $renderer->setTemplate(Template::getTemplate('passwordRecovery/password-recovery-message.tpl', 'tao'));
     foreach ($messageData as $key => $value) {
         $renderer->setData($key, $value);
     }
     return $renderer->render();
 }
開發者ID:nagyist,項目名稱:tao-core,代碼行數:23,代碼來源:PasswordRecoveryService.php


注:本文中的Renderer::setTemplate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。