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


PHP TemplateResponse::renderAs方法代码示例

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


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

示例1: testGetRenderAs

 public function testGetRenderAs()
 {
     $render = 'myrender';
     $this->tpl->renderAs($render);
     $this->assertEquals($render, $this->tpl->getRenderAs());
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:6,代码来源:TemplateResponseTest.php

示例2: render

 /**
  * Shortcut for rendering a template
  * @deprecated 7.0.0 return a template response instead
  * @param string $templateName the name of the template
  * @param array $params the template parameters in key => value structure
  * @param string $renderAs user renders a full page, blank only your template
  *                          admin an entry in the admin settings
  * @param string[] $headers set additional headers in name/value pairs
  * @return \OCP\AppFramework\Http\TemplateResponse containing the page
  * @since 6.0.0
  */
 public function render($templateName, array $params = array(), $renderAs = 'user', array $headers = array())
 {
     $response = new TemplateResponse($this->appName, $templateName);
     $response->setParams($params);
     $response->renderAs($renderAs);
     foreach ($headers as $name => $value) {
         $response->addHeader($name, $value);
     }
     return $response;
 }
开发者ID:samj1912,项目名称:repo,代码行数:21,代码来源:controller.php

示例3: afterException

 /**
  * If an AmpacheException is being caught, the appropiate ampache
  * exception response is rendered
  * @param Controller $controller the controller that is being called
  * @param string $methodName the name of the method that will be called on
  *                           the controller
  * @param \Exception $exception the thrown exception
  * @throws \Exception the passed in exception if it cant handle it
  * @return Response a Response object or null in case that the exception could not be handled
  */
 public function afterException($controller, $methodName, \Exception $exception)
 {
     if ($exception instanceof AmpacheException && $this->isAmpacheCall) {
         $response = new TemplateResponse($this->appname, 'ampache/error');
         $response->renderAs('blank');
         $response->addHeader('Content-Type', 'text/xml; charset=UTF-8');
         $response->setParams(array('code' => $exception->getCode(), 'message' => $exception->getMessage()));
         return $response;
     }
     throw $exception;
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:21,代码来源:ampachemiddleware.php


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