Archive for April, 2004

multiple rss feeds and geeklog

Ok, working again with kellan on doing multiple rss feeds for the new media alliance site. Got a good solution, or at least a hack which allows three different rss feeds to be displayed. Joy! I’m doing this in a geeklog block via lib custom.

function phpblock_getnews() {
require_once ‘/home/mediaalliance/public_html/scripts/magpie/rss_fetch.inc’;

// Set how often we want to update the feed (in hours)
$updateTime = 0;

// Open newsfeed page
$filename = “rssFeed.rdf”;

// Check the current time
$rawNowTime = time();

// Check the last time we modified the newsfeed page
$rawModifiedTime = filemtime($filename);

// Has it been long enough since we last updated it?
if ( (($rawNowTime - $rawModifiedTime) / 60 / 60) > $updateTime)
{
// Open the newsfeed file now so no one else grabs it while you’re populating it
$fp = fopen($filename, “w”);

// Set the number of headlines per site
$total = 4;

// Initialize our sites
$url[0] = ‘http://reclaimthemedia.org/backend/rtmsum.rdf’;
$url[1] = ‘http://pissedkid.net/medianews/index.rdf’;
$url[2] = ‘http://www.freepress.net/news/allnews.rss’;

// Fetch the XML for each one
$count = 0;
foreach($url as $thisURL)
{ $rss[$count] = fetch_rss($thisURL);
$count++;
}

// This is the variable we’ll use to write to the file
$string = “”;

// Print out the data for each one
foreach ($rss as $thisRSS)
{ // Display the site’s name
$string .= “From ” . $thisRSS->channel['title'] . “:
\n”;

// Limit to $total entries
$items = array_slice($thisRSS->items, 0, $total);

foreach ($items as $item ) {
$title = $item[title];
$linkURL = $item[link];
$date = $item[pubDate];
$description = $item[description];

// If we have no title, use the first 20 characters of the description
if ($title == “”)
{ $title = substr(strip_tags($description), 0, 20) . “…”;
}

// If we have no link, use the site’s link
if ($linkURL == “”)
{ $linkURL = $thisRSS->channel['link'];
}

// Add this headline to our variable
$string .= “- $title$date
\n”;
}

$string .= “\n
“;
}

// Write the data to the file
$write = fputs($fp, $string);
fclose($fp);
}

// Show the RSS!
// open the file, read it and dump it into
// a var.
$fp = fopen($filename, “r”);
$contents = fread($fp, filesize($filename));
fclose($fp);

return $contents;
}

Comments

Markdown and MI

After along converstation with Jason and Sascha over lots and lots and lots of sushi, I got convinced that the future of MI lies with some kind of markup language for creating pages. While I’m not sold on markdown, it seems like the logical way to go. Mostly I’m not sold as I feel grumpy about the author’s rather unsubtle dismisall of many a open source approach to a gui with a conclusion that isn’t far off the mark from “guis have to be created by corporations because they require a tremendous amount of work.” The implication being that you can’t create a a gui without coprorate sponsorship is of course a flip of logic- just because some good guis have been made in corporate environs (and like wise, some bad ones not) doesn’t mean that good ones have to be made there. Read the rant here: http://daringfireball.net/2004/04/spray_on_usability

Comments

Biotech, Race, and Capitalism

This is a link through to my gallery.

Comments

4096 color wheel

This is a super useful hex color tool. I really like it.

Comments

Ministry of Information


Comments

MI: CVS via RSS

Josh pointed out that he built a cvs -> rss gateway to alert about updates to the MI app. While I don’t really need all the stuff that is going in and out, it _is_ interesting to check out what is going into it. Plus I get to be all ?ber because I have a rss feed here now. Thanks, of course, goes to kellan> and the lovely magpie.

Comments