我有一个扩展的控制器类Zend\Mvc\Controller\AbstractActionController
。我想要一种操作方法来生成原子提要。
我启用了ViewFeedStratagy
module.config.php 中的:
return array(
'view_manager' => array(
'stratagies' => array(
'ViewFeedStratagy',
),
...
),
...
);
在我的控制器中,代码如下所示:
<?php
namespace Blog\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Zend\Feed\Writer\Feed;
use Zend\View\Model\FeedModel;
class BlogController extends AbstractActionController
{
// other action methods
public function atomAction()
{
$feed = new Feed;
// set feed data
$feed->export('atom');
$feedModel = new FeedModel();
$feedModel->setFeed($feed);
return $feedModel;
}
}
当我请求页面时,我得到:
PHP Fatal error:
Uncaught exception 'Zend\View\Exception\RuntimeException' with message
'Zend\View\Renderer\PhpRenderer::render:
Unable to render template "blog/blog/atom";
resolver could not resolve to a file'
为什么它仍在尝试使用Zend\View\Renderer\PhpRenderer
而不是Zend\View\Renderer\FeedRenderer
?