我怀疑正在显示博客的帖子[超过 1],现在我想根据发布日期显示博客意味着新帖子 1st 下 2nd 等等...我的代码
require_once('rss_fetch.inc');
$dateArray= "";
$urls = array(
'http://rajs-creativeguys.blogspot.com/feeds/posts/default?alt=rss',
'http://raghuks.wordpress.com/feed'
);
foreach($urls as $url) {
/*'http://raghuks.wordpress.com/feed/'*/;
$rss = fetch_rss($url);
foreach ($rss->items as $i => $item ) {
$title = strtoupper ($item['title']);
$url = $item['link'];
$date = substr($item['pubdate'],0,26);
$dateArray=array();
//code to fetch only some text
$desc = '';
$max = 30;
$arr = explode(' ', strip_tags($item['description']));
$l = count($arr);
if($l < $max) $max = $l;
for($j=0;$j<$max;++$j)
{
$desc .= $arr[$j] . ' ';
}
$desc .= '.....';
echo "<div class=\"blog\"><a target=\"_blank\" href=$url><h1>$title</h1>$desc<br/><br/>DATED : $date <br/><br/></a></div> ";
if($i == 1) break;
}
}
只有最近的 4 个帖子应该从任何博客显示,但应该根据日期请帮助.. 我尝试将所有日期放入数组并使用冒泡排序,但它不起作用.. 请帮助我.. 提前致谢