It turns out that PHP includes a way make XML, called SimpleXML. It’s actually quite simple to generate trees. For example, this would generate an xml file, with a node friend that has a child node userid with the value ‘123456.’
$xml = new SimpleXMLElement(‘<xml/>’);
$friend = $xml->addChild(‘friend’);
The big user facing feature is the dispatches feature. Dispatches are what I am calling statuses and wall posts. I built this feature from the ground up using XML. Beyond learning about XML, this feature helped me really understand MySQL subqueries, joins, and sorting keywords. The query is actually kind of interesting:
SELECT * from (SELECT * FROM messages where (userid = ‘$userid’ AND recipientid IS NULL) OR recipientid = ‘$userid’) as feed NATURAL JOIN userinfo as feedwithinfo ORDER BY timestamp DESC;
Changelog and Screenshots Below:
What’s new in version theBrotherhood 0.4 (Apr-23-2012):
*Dispatches. Now you can post dispatches for you and your friends to see. Your feed of dispatches is now on the homepage.
*Redesigned Profiles. Due to the addition of more features, User Profiles have been redesigned with a tab interface.
*Lots of the backend is now built on XML and is dynamically loaded in the background