Hello all,
I am working on a website and would like to add a page that allows users to login and post an entry (not a forum or chat) with a set number of fields. I want to have the homepage show the latest few entries and then be able to search by three things.
I have two books on PHP and one has a guestbook tutorial and the other has an online address book tutorial. Both have chapters on XML and the DOM.
So here is my thinking:
Use PHP to read the XML file and display the latest ten entries on the homepage. These entries contain year, type, the main content, source, date posted, and name. I want to be able to search by year, type, and name. For each of these, use this code to select the searches:
(From Book)
<?
$xml = simplexml_load_file("books.xml");
foreach($xml->Book as $Book) {
echo "
".$Book->Booktitle."<br>
".$Book->Bookauthor."<br>
".$Book->Bookpublisher."<br>
".$Book->BookISBN."<br>
".$Book->Bookprice."<br>
<hr>";
}
?>
(This is probably wrong in guesing)
<?
$xml = simplexml_load_file("content.xml");
if ( $Entry->Year == 2007 )
{
echo(
foreach($xml->Entry as $Entry) {
echo "
".$Entry->Year."<br>
".$Entry->Type."<br>
".$Entry->MainContent."<br>
".$Entry->Source."<br>
".$Entry->Date."<br>
".$Entry->Name."<br>
<hr>";
}
)
};
?>
Is there a way to make the 2007 part something that comes from a dropdown menu so that I don't have to make 67 pages (1940-2007)?
Does that make any sense at all or should I just give up???
Thanks,
Paul
BTW:Here is my DOM:
<?xml version="1.0"?>
<Entry>
<Year></Year>
<Type></Type>
<MainContent></MainContent>
<Source></Source>
<Date></Date>
<Name></Name>
</Entry>