sjg20010414 2013-08-16 18:07:10 3174次浏览 0条回复 0 0 0

参照电子文档《Agile Web Application Development with Yii 1.1》以及网站的指南,我模仿着把Zend框架的RSS Feed组件用到Yii框架中。 可能那个电子档是针对Zend Framework 1 的,而我下载的是 ZF2,所以,我对应进行修改。 我在public function actionFeed() 中代码部分如下:

$comments = Comment::model()->findRecentComments(20, $projectId);
        
        Yii::import('application.vendors.*');
        require_once('Zend/Feed/Writer/AbstractFeed.php');
        require_once('Zend/Feed/Writer/Feed.php');

        $feed = new Feed;
        foreach($comments as $comment){
            $entry = $feed->createEntry();
            $entry->setTitle($comment->issue->name);
            $entry->setLink(CHtml::encode($this->createAbsoluteUrl('issue/view',
                    array('id' => $comment->issue->id))));
            $entry->addAuthor(array(
                'name' => $comment->author->username,
                'email' => '',
                'uri' => '',
            ));
            $entry->setDateModified(strtotime($comment->create_time));
            $entry->setDateCreated();
            $entry->setDescription($comment->author->username . 'says:<br />'.$comment->content);
            $entry->setContent(
                'I am not writing the article. The example is long enough as is ;).'
            );
            $feed->addEntry($entry);
        }
        
        $feed->setTitle('Trackstart Project Comments Feed');
        $feed->setLink($this->createUrl(''));
        $feed->setEncoding('UTF-8');
        
        $feed->export('rss');

出现问题提示错误如下:

PHP warning
 include(Feed.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory 

无论怎么改,要么出现 类重复定义的错误,要么就是文件找不到

已将解压的ZF2的Zend目录放到以下目录 \trackstar\protected\vendors\Zend

有没有遇到类似问题或者知道原因的朋友 Thanks!

    没有找到数据。
您需要登录后才可以回复。登录 | 立即注册