I'm in the process of writing a media player application in PHP.
It allows people to connect and see what's playing, then vote to skip the track. has a web front-end and Air front-end. Connects to winamp, itunes or wmp. allows authentication via database, ldap..etc.. and hopefully nice and easily configurable.
I've written most of my classes as singletons, as there'll only ever be one of them. So using a static method you can easily get to that class from anywhere.
The problem i'm having is the output. I can't get my head around how to actually control the output. There will be two different output formats - one is HTML and one XML. The XML needs to be nicely formatted and the HTML needs to read in a template and give the template easy access to the data it needs.
But - what's the best way to do this? Do I let the XmlOutput object or HtmlOutput object directly access the singletons to get the data they need?
Or, do I have each class that could possibly output something inherit an interface which has, for example, GetOutputData()?
Basically, it is better to have my objects push data to the output class, or better to have my output class to pull the data from the objects (remember that they're all singletons)