我有一个一直困扰着我的问题。当我加载一个有提要的页面时。我把饲料放进去了wp-admin
; 这通常适用于其他提要,但不确定为什么不适用于这种提要。
加载提要时,出现以下错误:
[函数.文件获取内容]:未能打开流:达到重定向限制,正在/wp-content/themes/wp-jqm-01-skolledana/functions中中止。第624行的php。
NOTE:提要在浏览器中工作
这可能是一个解析器问题,如果是,我仍然无法解决它。
下面是解析器的一些代码,来自函数。php:
class rss_php {
public $document;
public $channel;
public $items;
/****************************
public load methods
***/
# load RSS by URL
public function load($url=false, $unblock=true) {
if($url) {
if($unblock) {
$this->loadParser(file_get_contents($url, false, $this->randomContext()));
} else {
$this->loadParser(file_get_contents($url));
}
}
}
# load raw RSS data
public function loadRSS($rawxml=false) {
if($rawxml) {
$this->loadParser($rawxml);
}
}
/****************************
public load methods
@param $includeAttributes BOOLEAN
return array; ***/
# return full rss array
public function getRSS($includeAttributes=false) {
if($includeAttributes) {
return $this->document;
}
return $this->valueReturner();
}
# return channel data
public function getChannel($includeAttributes=false) {
if($includeAttributes) {
return $this->channel;
}
return $this->valueReturner($this->channel);
}
# return rss items
public function getItems($includeAttributes=false) {
if($includeAttributes) {
return $this->items;
}
return $this->valueReturner($this->items);
}
What could the problem be ?
EDIT:这是我的rss功能: function get_rss($url, $lang, $articles) {
$rss = new rss_php;
$rss->load($url);
$items = $rss->getItems();
// Sets the maximum items to be listed
$max_items = $articles;
$count = 0;
$html = \'\';
// Translates months to swedish
foreach($items as $index => $item) {
$pubdateForeignString = substr($item[\'pubDate\'], 4);
$pubdateEnglishString = str_replace(array(\'maj\', \'okt\'), array(\'may\', \'oct\'), $pubdateForeignString);
$pubdate = date("Y-m-d", strtotime($pubdateEnglishString));
$html .= \'
<ul class="rssList">
<li class="itemTitle"><a href="\'.$item[\'link\'].\'" title="\'.$item[\'title\'].\'" rel="external"><h2>\'.$item[\'title\'].\'</h2></a></li>
<li class="itemText">\'.$item[\'description\'].\'</li>
<li class="itemLink"><a href="\'.$item[\'link\'].\'" title="\'.$item[\'title\'].\'" rel="external" class="readmore">Läs mer</a><em>Publicerad: \'.$pubdate.\'</em></li>
</ul>\';
$count++; //Increase the value of the count by 1
if($count==$max_items) break; //Break the loop is count is equal to the max_loop
}
echo $html;
}