几个月来,我们一直在我们的 Magento 安装上使用 SimplePie 将我们的博客文章拉入我们的主页而没有问题。由于 Magento 的其他一些问题,我们让我们的网络主机关闭了 APC 中的操作码。一旦我们这样做了,SimplePie 的下一个每小时更新停止加载主页并在 Apache 中返回以下错误:
[2012 年 1 月 18 日星期三 09:59:57] [错误] PHP 致命错误:在第 738 行的 {server root}/lib/SimplePie/simplepie.inc 中找不到类“Zend_Log”
我对正在发生的事情以及如何解决它有点茫然。SimplePie 以横幅/小部件的形式提供,因此如果我将其放在不同的类别页面上,我会得到相同的结果。(页面在 SimplePie 命令处停止)我希望这会是一些简单的事情,比如改变迫使旧的 chached RSS 保留并且无法修改,但我不确定。
任何帮助将不胜感激!
SimplePie 的代码未更改,版本为 1.2.1。我有一个页面 /app/design/frontend/default/default/template/page/html/blog.phtml 具有以下代码。
<div class="col-narrow right sidebar-blog">
<h2>Our Gardening Blog</h2>
<?php
// Make sure SimplePie is included. You may need to change this to match the location of
require_once('lib/SimplePie/simplepie.inc');
// We'll process this feed with all of the default options.
$feed = new SimplePie();
// Set which feed to process.
$feed->set_feed_url('http://blog.americanmeadows.com/feed/');
// Run SimplePie.
$feed->init();
// This makes sure that the content is sent to the browser as text/html and the UTF-8
$feed->handle_content_type();
/*
Here, we'll loop through all of the items in the feed, and $item represents the
current item in the loop.
*/
foreach ($feed->get_items(0,2) as $rss_item):
?>
<div class="article-teaser">
<p><span><?php echo $rss_item->get_date('F j, Y'); ?></span></p>
<h2 class="article-title"><a href="<?php echo $rss_item->get_permalink(); ?>"><?php echo $rss_item->get_title(); ?></a></h2>
<?php if ($rss_item->get_item_tags('', 'thumbnail')) {$thumbnail = $rss_item->get_item_tags('', 'thumbnail'); echo "<img src='" . $thumbnail[0]['data'] . "'>"; } ?>
<p><?php echo $rss_item->get_description(); ?> <a class="more" href="<?php echo $rss_item->get_permalink(); ?>" target="_blank">Continue Reading</a></p>
</div>
<?php endforeach; ?>
</div>
然后我有一个横幅,它只调用以下内容
{{block type="page/html" template="page/html/blog.phtml"}}
我将该横幅包含在我们主页的左栏小部件中以显示它。
SimplePie 中的行抛出错误是
function SimplePie($feed_url = null, $cache_location = null, $cache_duration = null)
{
// Other objects, instances created here so we can set options on them
$this->sanitize =& new SimplePie_Sanitize; /* Error is thrown here */
// Set options if they're passed to the constructor
if ($cache_location !== null)
{
$this->set_cache_location($cache_location);
}
我认为这是您需要的,但很高兴发布更多内容。