首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >CakePHP 1.3如何在显示内容之前呈现视图

CakePHP 1.3如何在显示内容之前呈现视图
EN

Stack Overflow用户
提问于 2017-07-18 19:10:34
回答 1查看 239关注 0票数 0

我使用的是CakePHP 1.3。我想要获取所有的html内容(table、div..)我的网页(.ctp)与CSS连接与其他文件pdf,

我试着使用类似这样的东西:

代码语言:javascript
运行
复制
$view = new View(null, false);
$view->set('timecard','masque');
$view->viewPath = 'pdf'; 
$output = $view->render('pdf', 'pdf');

代码语言:javascript
运行
复制
$view = new View($this, false);
$view->set(compact('timecard', 'masque'));
$html = $view->render('view_name');

谢谢你的帮助..

EN

回答 1

Stack Overflow用户

发布于 2017-07-19 02:37:40

请测试以下代码:

代码语言:javascript
运行
复制
/* Make sure the controller doesn't auto render. */
$this->autoRender = false;

/* Set up new view that won't enter the ClassRegistry */
$view = new View($this, false);
$view->set('text', 'Hello World');
$view->viewPath = 'elements';

/* Grab output into variable without the view actually outputting! */
$view_output = $view->render('box');
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45165098

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档