"9") { $news = "9"; } } function image_as_link($text){ // Build some regex (should be a *lot* faster) $pattern = '@]+)>@si'; // Gives us the URL in ${1}... $replacement = '[Image Link]'; // Turns that URL into a hyperlink $text = preg_replace($pattern, $replacement, $text); return $text; } require_once("boinc_news.php"); // Create channel header and open XML content // $description = "BOINC project ".PROJECT.": Main page News"; $channel_image = "http://boinc.berkeley.edu/www_logo.gif"; $create_date = gmdate('D, d M Y H:i:s') . ' GMT'; $language = "en-us"; echo " BOINC http://boinc.berkeley.edu News and announcements related to BOINC (Berkeley Open Infrastructure for Network Computing), an open-source platform for volunteer and grid commputing. U.C. Berkeley $create_date $language $channel_image BOINC http://boinc.berkeley.edu "; // - Create news items // $tot = count($project_news); $news = min( $tot, $news); for( $item=0; $item < $news; $item++ ) { $j = $tot - $item; if( count($project_news[$item]) == 2) { $d = strtotime($project_news[$item][0]); $news_date=gmdate('D, d M Y H:i:s',$d) . ' GMT'; $unique_url="http://boinc.berkeley.edu/all_news.php#$j"; $title = "BOINC news ". $project_news[$item][0]; $body = image_as_link($project_news[$item][1]); echo " $title http://boinc.berkeley.edu/all_news.php#$j $unique_url $news_date "; } } // Close XML content // echo "\n"; ?>