WORLD
   
 
 


simple php example using Magpie RSS



here is an example of displaying SPRACI listings for events over the next week for a chosen city using Magpie RSS


<?php

$areakeyword = 'x0sydney'; // spraci area keyword eg: x0sydney x2new_york x2london 
$category = 'all'; // all house techno trance hiphop electro drumbass goth psytrance industrial break reggae funk latin rock metal acoustic live gl singles exhibition workshops conference 
$oneoffsonly = 0; // one off events only 
$weeklyonly = 0; // weekly events only
$dateformat = 'l jS F Y'; // date format is in php date() format
$daterangestart = time() - 84600; // display events from 1 day ago 
$daterangeend = time() + (60*60*24*7); // up to 1 week in the future

//  ############################################################################################################################

$url = 'http://www.spraci.com/listrss2.php?parea=' . $areakeyword . '&category=' . $category . '&nodates=1&showdescriptions=1&';
require('magpierss/rss_fetch.inc');
if ($oneoffsonly) { $url .= '&oneoffonly=1'; }
if ($weeklyonly) { $url .= '&weeklyonly=1'; }
	
	$rss = fetch_rss( $url );
	echo "<b>" . $rss->channel['title'] . "</b><p>";
	echo "<ul>";
	foreach ($rss->items as $item) {
		$href = $item['link'];
		$title = $item['title'];	
		$description = $item['description'];	
		$startdate = strtotime($item['ev']['startdate']);	
		$enddate = strtotime($item['ev']['enddate']);
		if ($enddate < $startdate) { $enddate = $startdate; }
		if (($startdate >= $daterangestart) && ($enddate < $daterangeend)) {
			$startdate = date($dateformat,$startdate);	
			$enddate = date($dateformat,$enddate);
			if ($enddate == $startdate) { $enddate = ''; }
			$edates = $startdate;
			if ($enddate) { $edates .= ' - ' . $enddate; }	
			echo "<li><b><a href=\"$href\" target=\"_blank\">$title</a></b><br />";
			echo $edates . '<br />';
			echo $description;
			echo "</li>";
		}
	}
	echo "</ul>";

?>




If you have any questions you would like to see in here please contact us

 



FREE PUBLICITY


To list your event on spraci go to the ADD EVENT form and enter the details.
Its easy!