Hi Justin-- I've been wrestling with a similar problem.
You say: > I'm considering: > > a) storing this data in a MySQL table (a fairly simple > query) b) storing this data in a pseudo XML format like: > > <id>24</id> > <author>Justin French</author> > <author_email>[EMAIL PROTECTED]</author_email> > <date_published>2003-11-28</date_published> > <intro>This is my intro</intro> > <body>This is my text and html -- say 1000 words?</body> Um, the above isn't pseudo XML. It's actually perfectly fine XML. Nothing pseudo about it. > I'd love to > hear any opinions about which would form of data > retrieval would cause less of a performance burden on the > server. . . I've been wrestling with the same (or very similar) question: I'm trying to devise a flexible templating system where I can give my users control over content and inline formatting (allowing them to use, for example, <p>, <em>, <span>, <ul>) but retain control over page layout myself. It does seem to me that XML should play a role here, but I haven't been able to find the right XML tools. Ideally, the content would be stored in an XML document as you described. Your PHP page would use XPATH to address elements (or nodes) of the XML to set the value of PHP variables which would then be plugged into the HTML page. XPATH allows you to do that much. But every implementation of XPATH I've seen returns only the "CDATA" of an XML node, i.e. it strips out all the tags contained in the node. Thus you can't imbed formatting tags in the content. (I've been tempted to go ahead and do a "quick and dirty" system using a relational DB, but such a system would break down from complexity over time. You would need a new table for each set of page components [or else devise a very messy and unnormal system with one grand table of columns with multiple uses].) Am I missing something? Is there an implementation of xpath that does return the full contents of a node and not just the CDATA? I guess you could use regular top-level PHP to parse an XML document chracter by character, storing in an array pointers to the beginning and ending characters of each element (i.e. the first character following the start tag and the last character before the end tag). Then you could look up in the array each desired element and use substr() to read its value and set a PHP variable to it. Ideally, you would want a system that included a facility to edit the XML document as well as read it. This would be used in the user's interface for editing his content. I would think an easy first step would be to recreate (or reassemble) the XML document after each edit session. --John On Friday 13 June 2003 11:30 pm, Justin French wrote: > Hi all, > > I'm looking at a site where there will be a lot of > articles, all of which will be added once, and rarely > edited again... > > Let's say each article consisted of 6 data types: > - id > - author > - authorEmail > - datePublished > - introduction > - bodyText > > I'm considering: > > a) storing this data in a MySQL table (a fairly simple > query) b) storing this data in a pseudo XML format like: > > <id>24</id> > <author>Justin French</author> > <author_email>[EMAIL PROTECTED]</author_email> > <date_published>2003-11-28</date_published> > <intro>This is my intro</intro> > <body>This is my text and html -- say 1000 words?</body> > > > I plan on doing my own performance tests, but I'd love to > hear any opinions about which would form of data > retrieval would cause less of a performance burden on the > server (MySQL is on the same box as the htdocs and > apache). > > > TIA, > > Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php