You are here: Documentation » SimplePie Live! » API Reference » Syntax Notes
Syntax Notes
SimplePie Live! aims to be near-syntax-compatible with SimplePie, but there are two additional considerations to take into account:
- SimplePie Live is a JavaScript service, and should feel like JavaScript.
- Since SimplePie Live downloads and runs in the browser, file size is a major issue to take into account.
Because of these considerations, we've made some simple but significant changes to the syntax and API in SimplePie Live!
- The constructor feels more like you're using Ajax.Request() than calling a PHP constructor.
- There are different configuration options than the PHP version.
- The API contains NO methods… everything is a property.
- The
get_
has been removed from all names, and what's left has been camelCased. - All of the subscribing, bookmarking, data hacking, and data sanitizing methods have been removed (except for
feed.subscribeUrl
). - All singular methods have been removed; use the plural ones instead (as they're arrays).
Example Differences
See the following examples to see some of the differences:
Getting the title of the feed
// SimplePie under PHP $feed->get_title(); // SimplePie Live! feed.title;
Storing the first item's title in a 'title' variable
// SimplePie under PHP 4.x $item = $feed->get_item(0); $title = $item->get_title(); // SimplePie under PHP 5.x $title = $feed->get_item(0)->get_title(); // SimplePie Live! var title = feed.items[0].title;
live/reference/syntax_notes.txt · Last modified: 2011/03/06 03:56 (external edit)