$minword && strlen($sub) >= $length) { break; } } return $sub . (($len < strlen($str)) ? '...' : ''); } // // Print standard page header // function pageHeader($title="Main") { echo << PLplot Home Page - $title END; } // // Print menu code with selected element // $item might be: index, downloads, examples, development, credits // function pageMenu($item)# { echo "
\n"; echo "
\n"; echo ' '; } // // Print a standard page footer // function pageFooter() { echo ' '; } // // Print News from project page // $newscount - number of news itmes to be shown // $contentlength - defines the length in characters of the news content // function pageNews($newscount, $contentlength) { // Open the PLplot News RSS feed and parse it (rss link taken from the plplot project page) $feed = new SimplePie(); $feed->enable_cache(false); // disable cache $feed->set_feed_url("http://sourceforge.net/p/plplot/news/feed"); $feed->init(); $feed->handle_content_type(); // In case of error show error //if($feed->error()) // echo $feed->error(); // show news items if($feed->data) { $items = $feed->get_items(); $i = 0; foreach($items as $item) { echo '

' . $item->get_title() . '

' . "\n"; echo '

' . _substr(strip_tags($item->get_content()), $contentlength) . ' '; echo 'Read more (' . $item->get_date('j M Y') . ')

' . "\n"; $i = $i + 1; if( $i >= $newscount ) break; } } else echo '

Could not open News feed!

'; } // // Print a standard sidebar // function pageSidebar($news=0) { echo <<
END; // Permanently disable and do another way (see above) // because pageNews calls SF php script that returns // bad URL's. echo "

News

\n"; pageNews(3, 100); echo <<Resources

Source Code

END; } ?>