Example of using RSS to display different love quotes of the day (v4.1.0)
Code:<? /* Love Quotes Of The Day http://www.modmysite.com support@modmysite.com Instructions ------------ 1) Install Magpie RSS reader ( http://magpierss.sourceforge.net/ ). 2) Setup the cache directory as explained in the Magpie instructions. 3) Save this page as lovequotesoftheday.php 4) Add these entries to your language file: // Love Quotes Of The Day case "_LQUOTESOFTHEDAY_H": return "Love Quotes Of The Day"; case "_LQUOTESOFTHEDAY_H1": return "Love Quotes Of The Day"; 5) Give it a try. http://www.yoursite.com/lovequotesoftheday.php 6) First time, load will be slow, but after that, it will come from the RSS cache 7) Add a link from someplace on your site to this page, lovequotesoftheday.php */ require_once( "inc/header.inc.php" ); require_once( "$dir[inc]db.inc.php" ); require_once( "$dir[inc]design.inc.php" ); require_once( "$dir[inc]profiles.inc.php" ); require_once( "magpierss/rss_fetch.inc" ); // --------------- page variables and login // No special template needed, uses the default template as 16 does not exist $_page[name_index] = 16; $_page[header] = _t( "_LQUOTESOFTHEDAY_H" ); $_page[header_text] = _t( "_LQUOTESOFTHEDAY_H1" ); // --------------- page components $_ni = $_page['name_index']; $_page_cont[$_ni]['page_main_code'] = PageCompPageMainCode(); // --------------- [END] page components PageCode(); // --------------- page components functions /** * page code function */ function PageCompPageMainCode() { global $content_w; $out = ""; $out .= "<table width=".($content_w-20)." cellpadding=4 cellspacing=4><td align=center class=text2>"; $url = "http://www.brainyquote.com/link/quotelo.rss"; $rss = fetch_rss($url); foreach ($rss->items as $item) { $href = $item['link']; $title = $item['title']; $description = $item['description']; $out .= "<b>$title</b><br>$description<br><br>"; } $out .= "</td></table>"; $out .= "Quotes Updated Daily"; return $out; } ?>


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks