Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-11-2006, 05:00 PM   PM User | #1
mark87
Senior Coder

 
Join Date: Dec 2004
Location: Essex, UK
Posts: 2,636
Thanks: 0
Thanked 0 Times in 0 Posts
mark87 is on a distinguished road
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?
__________________
markaylward.co.uk
mark87 is offline   Reply With Quote
Old 01-11-2006, 05:39 PM   PM User | #2
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,904
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
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)
firepages is offline   Reply With Quote
Old 01-11-2006, 10:10 PM   PM User | #3
mark87
Senior Coder

 
Join Date: Dec 2004
Location: Essex, UK
Posts: 2,636
Thanks: 0
Thanked 0 Times in 0 Posts
mark87 is on a distinguished road
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?)
__________________
markaylward.co.uk
mark87 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:48 AM.


Advertisement
Log in to turn off these ads.