useCached(); // use cached version if age<1 hour //$rss->title = "Bookmarks"; //$rss->description = "Bookmarks"; $rss->syndicationURL = "http://www.TheHouseOfOojah.com/feed".$_SERVER["PHP_SELF"]; // set up incrementing value $i = 0; $common_words ="the the the of of of to to to and and and a a in in in is is is it it you you that that he he was for on on are with as I his they be at one have this from or had by hot but some what there we can out other were all your accept allow ask believe borrow close pay play put rain read change cancel need open teach want worry write lose forget fix"; // added to connect to server? $mysql_link = mysql_connect ("localhost", "gregoz_delbase", "willunga") or die ('I cannot connect to the database because: ' . mysql_error()); // is this a duplicated redundant command? mysql_select_db("gregoz_delbase", $mysql_link); $res = mysql_query("SELECT * FROM deltable WHERE tags like '%ozpowersellers%' ORDER by rand() LIMIT 100"); while ($data = mysql_fetch_object($res)) { $item = new FeedItem(); // increment $i = $i + 1; // convert data to arrays $tags_array = explode(" ",$data->tags); $data_array = explode(" ",$data->description . $common_words); //combine the two arrays $big_array = $tags_array + $data_array; // get the first few words of the description and save them if (strlen($data->description)>20) { $start_descript = substr($data->description,0,strpos($data->description," ",19)); } else { $start_descript = $data->description; } //shuffle it shuffle($big_array); // randomly pick out some anchor text - 5 words array has been shuffled if (count($big_array)>5) { $anchor_array = array($big_array[1],$big_array[2],$big_array[3],$big_array[4],$big_array[5],$big_array[6]); } else { $anchor_array = $big_array; } ///anchor text for the link plus add the start words saved $item->title = $start_descript . " " . implode(" ",$anchor_array); // add the URL $item->link = $data->url; // put the mixed tags and the description together then add the unshuffled description $item->description = implode(" ",$big_array) . " " . $data->description; $item->source = "http://www.TheHouseOfOojah.com.au/"; $item->author = "The House of Oojah"; $rss->addItem($item); // insert quality links after the first 3 items add only 3 links - mid feed links if (($i == 3)OR($i == 6)OR($i ==9)OR($i ==12)) { $mysql_link_extra2 = mysql_connect ("localhost", "qualinkbase", "willunga") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db("qualinkbase", $mysql_link_extra2); $res_extra2 = mysql_query("SELECT * FROM linktable ORDER by rand() limit 3"); while ($data2 = mysql_fetch_object($res_extra2)) { $extralinks2 = new FeedItem(); $extralinks2->link = $data2->link; $extralinks2->title = $data2->link; // add it to the feed $rss->addItem($extralinks2); } } // end of mid feed links } //add extra high value links at the bottom of the feed from qualinkbase $mysql_link_extra = mysql_connect ("localhost", "qualinkbase", "willunga") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db("qualinkbase", $mysql_link_extra); $res_extra = mysql_query("SELECT * FROM linktable ORDER by rand() LIMIT 3 "); while ($data = mysql_fetch_object($res_extra)) { $extralinks = new FeedItem(); $extralinks->link = $data->link; $extralinks->title = $data->link; // add it to the feed $rss->addItem($extralinks); }//end while for added end qualinks // valid format strings are: RSS0.91, RSS1.0, RSS2.0, PIE0.1 (deprecated), // MBOX, OPML, ATOM, ATOM0.3, HTML, JS echo $rss->saveFeed("RSS2.0"); ?>