即不支持饲料cakephp中的dtds

时间:2011-05-04 19:47:32

标签: cakephp rss cakephp-1.3 dtd

好的我正在尝试使用cakephp rss helper为应用程序的某些帖子创建一个rss feed。我跟着cakephp书到信,它不能与Internet Explorer一起工作......当我用Opera打开它时它工作但是它说“Internet Explorer不支持带有DTD的提要。”......

我知道微软不支持dtd,因为安全线程但我该如何解决这个问题呢?我工作的公司使用ie标准,因此更改浏览器不是一种选择......

这是代码......所以你可以看到它没有市长修改......

default.thtml中

echo $this->Rss->header();
if (!isset($documentData)) {
    $documentData = array();
}
if (!isset($channelData)) {
    $channelData = array();
}
if (!isset($channelData['title'])) {
    $channelData['title'] = $title_for_layout;
} 
$channel = $this->Rss->channel(array(), $channelData, $content_for_layout);

echo $this->Rss->document($documentData,$channel);

index.ctp

 $this->set('documentData', array(
 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/'));
 $this->set('channelData', array(
 'title' => __("Most Recent Hitos", true),
 'link' => $this->Html->url('/', true),
 'description' => __("Most recent Hitos.", true),
 'language' => 'en-us')); 


 foreach ($posts as $post) {

    $postLink = array(
        'controller' => 'soportes',
        'action' => 'view',
        $post['Soporte']['id']);
    // You should import Sanitize
    App::import('Sanitize');
    // This is the part where we clean the body text for output as the description 
    // of the rss item, this needs to have only text to make sure the feed validates
    $bodyText = preg_replace('=\(.*?\)=is', '', $post['Hito']['actividad']);
    $bodyText = $this->Text->stripLinks($bodyText);
    $bodyText = Sanitize::stripAll($bodyText);
    $bodyText = $this->Text->truncate($bodyText, 400, array(
        'ending' => '...',
        'exact'  => true,
        'html'   => true,
    ));

    echo  $this->Rss->item(array(), array(
        'title' => $post['Hito']['actividad'],
        'link' => $postLink,
        'guid' => array('url' => $postLink, 'isPermaLink' => 'true'),
        'description' =>  $bodyText,
        'dc:creator' => $post['Hito']['user_id'],
        'pubDate' => $post['Hito']['fecha_sugerida']));
}

1 个答案:

答案 0 :(得分:0)

在非常基础的层面上,可能是因为core.php中的调试级别 - cake输出渲染时间我认为 - 你可以尝试设置Configure :: write('debug',0);在您的控制器操作中查看它是否在IE中呈现?由于这个原因,我之前遇到过XML / RSS和IE的问题。