Page 1 of 1

PHP with XML, simple blog

Posted: Fri Jun 30, 2006 8:21 pm
by midfielder
Ok I am making a simple blog script with XML.
My problem is reading from the XML file.
I only want to display the latest blog post, which should be the last element from my XML file. I also have links included like "Next" / "Previous" where if clicked it'll goto the next and previous posts from the XML file.

Anyway, how can I display only one, the latest post on the web page without loading the entire XML file to memory and sifting through it all to the last element?
And how can i jump to the next element?

If I were using javascript it would be easy by using javascript:productTable.nextPage() and doing something like <table datasrc='#xmldata' datapagesize="1" id="productTable"> <span datafld='element1'>

But I'm trying to do it with PHP.

Posted: Sat Jul 01, 2006 6:06 pm
by tecktalkcm0391
How are the XML sheet made? By a database query?

Posted: Sat Jul 01, 2006 6:49 pm
by Robert Plank
Multiple XML files, one for each entry?

Or an XML list of byte offsets for each entry in the file.

Posted: Mon Jul 03, 2006 12:49 am
by texasrenegade
To only get one result, you are changing the repeat region by a set number and not all.

To get the latest one, you set the sort order, ascending or descending, descending in this case.

Posted: Mon Jul 03, 2006 12:58 am
by RobertGonzalez
Midfielder, post some XML. I think that would be helpful to everyone that reads this post.

Texasrenegade, got any examples? Again, that would be very helpful for folks that are reading this later and are looking for the same type of help.

Posted: Mon Jul 03, 2006 4:28 pm
by texasrenegade
I only know how to do this in Dreamweaver. I use xhtml transitional but could be using strict.

Here is a link to a tutorial

http://livedocs.macromedia.com/dreamwea ... _dis14.htm

that saves me from detailing all the steps.

Also on a side note:

Note: Microsoft ASP.NET refers to a recordset as a DataSet. If you are working with ASP.NET document types, the dialog boxes and menu choices specific to ASP.NET use the label DataSet. The Dreamweaver documentation generically refers to both types as recordsets, but uses DataSet when specifically describing ASP.NET features.

Now, there are even behaviors or extensions available for Dreamweaver to help this. I could create an example I guess and he could just modify the code... for his needs.

Let me know...


r

Posted: Mon Jul 03, 2006 4:44 pm
by texasrenegade
Ok,

go here

http://localhost/Client_durys/HTML_page ... isplay.php

and click on the link Testing Theory

and see how the pages will have PREV and NEXT for the records.


Is this what you mean?



r

Posted: Mon Jul 03, 2006 8:09 pm
by hawleyjr
texasrenegade wrote:Ok,

go here

http://localhost/Client_durys/HTML_page ... isplay.php

and click on the link Testing Theory

and see how the pages will have PREV and NEXT for the records.


Is this what you mean?



r
You linked to your localhost sever. You'll need to post an IP address or transfer the files to a server :)

Posted: Mon Jul 03, 2006 8:32 pm
by texasrenegade