Hi,
I've done this a couple of times in a couple of different ways. It may help you not to think of the design but think of the requirements.
If you need a system which allows lots of users to submit content, one method may be to use an offline client such as XMETAL and a DTD to allow users to sit at their PC and create well-formed XML content. After the content is created they login to a web-based application where they start the content upload workflow.
Hypothetical Steps:
1) Choose the category the content belongs to
2) Upload the XML document to the server via a form
3) Workflow reads the XML and checks that it is well formed (it should be if the DTD is in place
4) The title, author, date etc are read from the XML via PHP, the user is prompted for a search engine friendly descripition of the content (or this may also be read from the XML.
5) The user fills out any other properties, for example expiry date, links to other documents etc
6) The user then uploads any images associated with the content
7) All of the information as well as the location of the XML document is stored in a database, this will be used for managing content, and searching.
8) The content may then need to be checked etc or authorised before the document goes live.
On the site, the XML is then read from the disk and formatted in to XHTML/HTML etc via the use of XSL.
Another way to do which I have used before it is to store all of the content in the database, the first time any user requests it, the results of the query are cached to XML. You then use XML/XSL to transform to XHTML/HTML. This works really well if you have content which changes regularly but is not truly dynamic, for example stock lists. Stock lists change regularly but are not dynamic they are not different for each user. You can store the query results as hashes in a table, for example I did something similar with this quick pseudo code
$query = 'SELECT fields FROM table';
$hash = md5($query);
if(file_exists('/var/xml_chunks/'.$hash.'.xml')) {
// query already exists
$xml_file = $hash.'.xml';
}
else {
$result = mysql_query($query);
$xml = customXMLFunction(mysql_fetch_assoc($result));
writeXMLtoFile($hash);
$xml_file = $hash.'.xml';
}
transform($xml, 'xsl.xsl');
There are added benefits to this method, if you have a fairly complex data set instead of querying only what you need, query everything, all the linked tables etc in to one massive XML file then use different XSL files to drop the information you don't need. You may have 30 different queries that all in reality use one XML file there's no database use for day to enquiries. Just make sure you have a sufficient mechanism in place that you can realise when the db contents have changed and you can drop the XML file.
I really think as we move forward with PHP in the enterprise we're going to see a massive take up of XML/XSL based content management / template systems.
Before the critics start, I've highlighted two possible systems, this is not the definitive lists, it's to help the original OP with their thoughts, and no, the pseudo code is not supposed to actually work!
Andrew