Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: XML-Based CMS

  1. #1
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts

    XML-Based CMS

    Following on from an earlier post...

    I've created the forms etc, I just need a way to save dates+events to an XML file. eg.

    <event>
    <date>01.01.06</date>
    <description>Blah</description>
    </event>

    Now, there'll be many events; and as well as adding an event to the XML file I'll need a way of displaying the information from the XML file onto a page, in date order.

    Any ideas on how to do this?

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,070
    Thanks
    11
    Thanked 96 Times in 94 Posts
    Quote Originally Posted by mark87
    ...Now, there'll be many events; ...in date order.

    Any ideas on how to do this?
    yes , don't use XML use a database ,
    ... ok I just read the other thread and see that is not an option, so while XML is fine for storage it is not (even with Xpath (simpleXML in PHP5 etc)) a good medium to search and query especially with say hundreds of records.

    I would suggest 1 XML file per item and keep another index file (you are now creating a database ) with either XML if you must or much faster PHP arrays of indexes , you can keep that index in date order and even with a few hundred entries it wont be too much work for PHP to load and mung..
    (ksort() is your friend here)

    e.g. in the below array '1' would relate to article /blah/1.xml dated 2006/jan/10 ( I like that YYYYMMDD timestamp format since its easy to perform simple greater than or less than logic on it)

    PHP Code:
    <?php
    $idx
    =array(20060110=>1,20060111=>2,'etc');
    ?>
    OK now you probably have to include multiple XML files which is in itself not the most efficient way to go about it but I think far better than parsing a ?kb XML file.
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, hmm sounds a bit complicated.

    How about... (and it's really basically scrapping the XML idea), because I know who'll be using it, just to basically have one textarea, whatever text is in there gets saved to a flat file, and then then the text is displayed on a page (although I'm not sure how the formatting could work - don't really wish to use a rich text area). The text from the text file would also have to be brought up into the textarea when the editing page loads.

    How would this be done? (I mean, I know that the text can be displayed on a page using an include; but what about the rest?)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •