【发布时间】:2011-06-26 08:22:10
【问题描述】:
我有一个像这样的 MyData.php 类:
class myData {
function render() {
$view = new Zend_View();
$view->str = 'This is string.';
echo $view->render('myview.phtml');
}
}
和一个 myview.phtml 文件:
<div id='someid'><?= $this->str ?></div>
在另一个视图中,我正在做这样的事情:
<?php
$obj = new myData ();
$obj->render(); // it should be <div id='someid'>This is string.</div>
?>
它给了我以下异常:
Message: no view script directory set; unable to determine location for view script
MyData.php 和 myview.phtml 在同一目录中。
【问题讨论】:
-
@prodigitalson:你能提供一个符合我上述要求的例子吗?
标签: php zend-framework view render