本文整理汇总了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;
}
示例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;
}
示例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();
}