Using Feedcreator to generate ATOM 1.0 feeds

I’m going give out a tip on using feedcreator class library to ease up generating syndication feeds for your web project. As you might know, there are different kind of syndication format out there such as RSS 2.0, RSS 1.0, RSS0.91, ATOM0.3 and ATOM1.0. Each of the syndication format has its own markup (though RSS 0.91 and 2.0 are closely related), making generating feeds from scratch can be quite a chore for your project.

Feedcreator provides an easy way to create RSS and ATOM feeds from within PHP using ease to use classes. However, feedcreator has a couple of drawback :

  1. It does not support ATOM 1.0
  2. Doesn’t support Enclosure
  3. Can’t generate feeds on the fly

Though these drawbacks might not be as serious as I put in here, it is nice to have this features implemented on feedcreator. ATOM 1.0 is a new syndication format issued by IETF as a standard way to produce feeds, ATOM 1.0 has a nice features and more structured layout than the ever-inconsistent RSS feeds.

Though Enclosure tag is optional in RSS 2.0, the tag is significant for those who are into podcasting or photoblogging. Enclosure feature allows for the syndicated feed to not just serve text content, but also to package an enclosure (call it an attachment of some sort), as well. IIn the podcasting model, the RSS enclosure contains an audio file, which subscribers can listen to on their devices.

Generating feeds on the fly is one of the most requested feature of feedcreator. This allows feeds to be generated dynamically upon request as opposed to generating feed on certain event (such as posting new articles). Mambo and PhpGedView project uses modified Feedcreator to generate feeds on-the-fly.

I’ve published a modified version of Feedcreator (namely Feedcreator 1.7.2-ppt) that contains all of these enhancements (or hacks). Here’s a snippets on how to use the additional features :


/*

This demo is to illustrate how to use feedcreator
using outputFeed function, ATOM1.0 and enclosure
support.

Enclosure support is useful if you are into
podcasting or publishing photoblog.

the required parameter for enclosure is url, length
and type (as in MIME-type)

*/

< ? php include ("include/feedcreator.class.php"); //define channel $rss = new UniversalFeedCreator(); $rss->useCached();
$rss->title="Personal News Site";
$rss->description="daily news from me";
$rss->link="http://mydomain.net/";
$rss->syndicationURL="http://mydomain.net/$PHP_SELF";

//channel items/entries
$item = new FeedItem();
$item->title = "test berita pertama";
$item->link = "http://mydomain.net/news/somelinks.html";
$item->description = "hahaha aku berjaya!";
$item->source = "http://mydomain.net";
$item->author = "my_email@mydomain.net";

//optional enclosure support
$item->enclosure = new EnclosureItem();
$item->enclosure->url='http://mydomain.net/news/picture.jpg';
$item->enclosure->length="65905";
$item->enclosure->type='image/jpeg';

$rss->addItem($item);

//Valid parameters are RSS0.91, RSS1.0, RSS2.0, PIE0.1 (deprecated),
// MBOX, OPML, ATOM, ATOM1.0, ATOM0.3, HTML, JS

$rss->outputFeed("ATOM1.0");
//$rss->saveFeed("ATOM1.0", "news/feed.xml");

?>

You can download the modified version of Feedcreator 1.7.2 from my server, the zip package contains the modified class library, GNU/LGPL license, some demo php file and a diff file against the plain vanilla Feedcreator 1.7.2 for curious people.

p/s : all of the modifications are written by me except outputFeed function which is written by Fabian Wolf.

Download :
Feedcreator 1.7.2-ppt (zip)

Feedcreator website : http://www.bitfolge.de/rsscreator-en.html

RSS 2.0 / Atom 1.0 for Coppermine 1.3.x plugin

Coppermine 1.3.x Plugin RSS 2.0

I’ve made some improvements over my previous Coppermine plugin.

I’ve added Atom 1.0 support and picture caption to the published feed. I’ve also altered the default feed to publish the latest 10 photos instead of 6.

Well, glad to have a plugin that can publish both RSS and Atom feed in Coppermine 1.3.x

old Download links :

  1. zip package
  2. tar.gz package

Download Coppermine RSS/ATOM plugin here:

  1. Mirror #1
  2. Mirror #2
  3. Mirror #3

*Note that this plugin worked under Coppermine 1.4.x also, but it is untested with PHP 5.x.

Hacked RSS 2.0 for Coppermine 1.3.x plugin

Coppermine Logo

I’ve got over my boredom by coding a simple RSS 2.0 plugin for Coppermine 1.3.x.

This plugin simply publish your latest photo(s) via RSS 2.0 feed through the url http://yourgallery.com/rss20.php. It is easy to install and only contains one file! Just upload the rss20.php to the root directory of your Coppermine installation, and off it goes!

I’ve decided to release the plugin to public under the GNU General Public License 2.0. Please mail me any suggestions or feedback!

Download links :

  1. tar.gz package
  2. zip package

Simple Affiliate software script

The past few days i’ve been searching for a simple and free affiliate script to integrate into my personal project.

The reason why i chose free (as in free beer) is because I dont have the budget to spend on expensive affiliate tracking software such as iDevAffiliate, ClixGalore and TradeDoubler.

The quest brought me to PostAffiliate, which is released as GNU/GPL and it was based on PHP-Affiliate v1.2. The PostAffiliate website claim that they fixed vulnerability in PHP-Affiliate, but upon using the software, i felt that PostAffiliate 1.3 has serious flaw in which the user password is stored as a plain-text in the database!

So i’ve taken my time to touch up PostAffiliate 1.3, mainly to fix the plaintext password storing method in PostAffiliate. The password is now hashed in SHA-1 before stored in the database. I’ve also fix some potential security vulnerability point and updated the login page (I plan to clean the code as it’s too messy).

Here’s my half-assed (actually 1 hour) modifications on PostAffiliate : PostAffiliate fix

Stay tune as i’m planning to rewrite most of the postaffiliate part and release the modification under GNU/GPL.

keyword : free affiliate php software script

jar2jad – My first python application

I’m publishing my first python apps from my self-taught python class as promised.

This apps generates JAD file from *.jar file which is widely used in J2ME java mobile application. This apps is simple+compact and can be executed in any platform that supports python.

I was going to publish this earlier, but I’ve been busy for the past few days doing other stuff besides python.

Download links

  1. jar2jad-0.1.tar.gz
  2. jar2jad-0.1.zip

Python is interesting, i might create and publish more apps in python to polish up my skills.

Learning Python as an Additional Language

Python logoToday is the second day of September, and I decided to learn python for the whole month.Why Python? Well, first of all, python is a fairly simple language to learn and it’s a shame if I don’t fully utilize my free time to learn programming in python.

Secondly, python is a flexible language, i.e it can be use for programming web-applications as well as creating standalone applications, and…

Finally, python is a portable language, and I just love the python language concept which combines simplicity and powerful features such as classes, exceptions, dynamic data types and dynamic typing.

The fact that python is executed by interpreter accelerates my learning process as I dont have to wait long to see the results of my progress and experiments ;)

Anyhow, you can expect to see python apps written by me after this!