Kijk verder op mijn weblog // www.mikevanhoenselaar.nl"; return $s2; } function haalaantalreactiesbericht($bid) { $query = "SELECT * FROM reacties WHERE bericht_ID = '$bid'"; $result = mysql_query($query); if($result) { $aantal = mysql_num_rows($result); } else { $aantal = "0"; } return $aantal; } function haalcategorienaam($catid) { $query = "SELECT * FROM categorieen WHERE categorie_ID = '$catid'"; $result = mysql_query($query); if($result) { $row = mysql_fetch_assoc($result); $catnaam = $row["categorie_naam"]; } else { $catnaam = "None"; } return $catnaam; } function dateFormat($sDateFormat, $sDateField, $kolomnaam, $sTaal = 'en'){ // format een datetime veld uit mysql met de argumenten van de functie date() $aDate = array(); $aDate['d'] = 'DATE_FORMAT(' . $sDateField . ", '%d')"; $aDate['g'] = 'DATE_FORMAT(' . $sDateField . ", '%l')"; $aDate['G'] = 'DATE_FORMAT(' . $sDateField . ", '%k')"; $aDate['h'] = 'DATE_FORMAT(' . $sDateField . ", '%h')"; $aDate['H'] = 'DATE_FORMAT(' . $sDateField . ", '%H')"; $aDate['i'] = 'DATE_FORMAT(' . $sDateField . ", '%i')"; $aDate['j'] = 'DATE_FORMAT(' . $sDateField . ", '%e')"; $aDate['m'] = 'DATE_FORMAT(' . $sDateField . ", '%m')"; $aDate['n'] = 'DATE_FORMAT(' . $sDateField . ", '%c')"; $aDate['s'] = 'DATE_FORMAT(' . $sDateField . ", '%S')"; $aDate['Y'] = 'DATE_FORMAT(' . $sDateField . ", '%Y')"; $aDate['y'] = 'DATE_FORMAT(' . $sDateField . ", '%y')"; $aDate['z'] = 'DATE_FORMAT(' . $sDateField . ", '%j')"; $aDate['w'] = 'DATE_FORMAT(' . $sDateField . ", '%w')"; $aDate['%'] = '%%'; switch ($sTaal){ case 'nl': $aDate['D'] = 'ELT((WEEKDAY('. $sDateField .")+1), 'Mon','Tue','Wed','Thu','Fri','Sat','Sun')"; $aDate['F'] = 'ELT(MONTH(' . $sDateField . "), 'Januari','Februari','Maart','April','Mei','Juni', 'Juli','Augustus','September','Oktober','November', 'December')"; $aDate['l'] = 'ELT((WEEKDAY(' . $sDateField . ")+1), 'maandag','dinsdag','woensdag','donderdag','vrijdag', 'zaterdag','zondag')"; $aDate['m'] = 'ELT(MONTH(' . $sDateField . "), 'jan','feb','mrt','apr','mei','jun','jul', 'aug','sep','okt','nov','dec')"; break; case 'en': $aDate['D'] = 'DATE_FORMAT(' . $sDateField . ", '%a')"; $aDate['F'] = 'DATE_FORMAT(' . $sDateField . ", '%M')"; $aDate['l'] = 'DATE_FORMAT(' . $sDateField . ", '%W')"; $aDate['m'] = 'DATE_FORMAT(' . $sDateField . ", '%b')"; break; } $aReturn = array(); $iFormatLength = strlen($sDateFormat); for($i = 0; $i <$iFormatLength; $i++) { // replace argumenten per karakter $sChar = substr($sDateFormat, $i, 1); if (array_key_exists($sChar, $aDate)){ $aReturn[] = $aDate[$sChar]; } else { $aReturn[] = "'" . $sChar . "'"; } } return 'CONCAT(' . implode(',', $aReturn) . ') AS ' . $kolomnaam; } include("feedcreator.class.php"); if (empty($_GET["cid"])) { $catnaam = ""; $bestandsnaam = ""; $catquery = ""; } else { //alleen 1 categorie $catnaam = " // " . haalcategorienaam($_GET["cid"]); $bestandsnaam = "1"; $catquery = "AND categorie_ID = '" . $_GET["cid"] . "'"; } $rss = new UniversalFeedCreator(); $rss->useCached(); $rss->title = "Trendensity by Mike van Hoenselaar" . $catnaam; $rss->language = "nl"; $rss->editor = "mike@mikevanhoenselaar.nl"; $rss->webmaster = "mike@mikevanhoenselaar.nl"; $rss->description = "Mike van Hoenselaar, trendspotter, a global view of his life. He shows you new views, new perspectives and new ideas in the trendensity web world. Set trends don't follow them."; $rss->link = "http://www.mikevanhoenselaar.nl"; $rss->syndicationURL = "http://www.mikevanhoenselaar.nl/".$PHP_SELF; $image = new FeedImage(); $image->title = "Trendensity by Mike van hoenselaar v2 // Logo"; $image->url = "http://www.mikevanhoenselaar.nl/images/headerimage.jpg"; $image->link = "http://www.mikevanhoenselaar.nl"; $image->description = "Trendensity by Mike van Hoenselaar v2 // logo for distribution on the web."; $rss->image = $image; // get your news items from somewhere, e.g. your database: $res = mysql_query("SELECT *," . dateFormat('D, d m Y H:i:s', 'bericht_datum2','datumtijd') . " FROM berichten WHERE bericht_zichtbaar = '1' $catquery ORDER BY bericht_datum DESC LIMIT 0,50"); if ($res) { $aantal = mysql_num_rows($res); if($aantal >= "1") { while ($data = mysql_fetch_assoc($res)) { $item = new FeedItem(); $bid = $data["bericht_ID"]; $aantalreacties = haalaantalreactiesbericht($bid); if ($aantalreacties!="") { if ($aantalreacties == "1") { $toevoeging = ""; } else { $toevoeging = "s"; } $reacties = " (" . $aantalreacties . " reactie" . $toevoeging.")"; } else { $reacties = ""; } $item->title = html_entity_decode(stripslashes($data["bericht_kop"])) . $reacties; $item->link = "http://www.mikevanhoenselaar.nl/bericht.php?bid=" . $bid; $categorie = haalcategorienaam($data["categorie_ID"]); $item->description = "

" . $categorie . "

" . html_entity_decode(stripslashes($data["bericht_inhoud"])) . "

Plaats een reactie

"; $item->date = $data["datumtijd"]; $item->source = "http://www.mikevanhoenselaar.nl"; $item->author = "Mike van Hoenselaar, mike@mikevanhoenselaar.nl"; $rss->addItem($item); } } } if(empty($bestandsnaam)) { $bestandsnaam = "feed.xml"; } else { $bestandsnaam = "feed-" . strtolower($categorie) . ".xml"; } $rss->saveFeed("RSS2.0", $bestandsnaam); ?>