> I am trying to prepare for my third year project which basically
consists of a dynamic web site where people can log in and create
profiles, also being able to administer the site so that statistics
can be obtained, the details of which are irelavent.
I have been learning php & mysql do implement the project and I
"thought" the end product would be in HTML however I have since
learned it must be in XML.
So now I am trying to learn as much XML as I can and am slowly coming
to grips with it. However the link I see between PHP and XML seems
quite fuzzy. As the end result must be in XML it is just a straight
swap between inserting PHP code into my XML document as it is with
HTML or is it more complicated than that?
Cheers!
You can't have a website "in XML" as such - it can use XML, but you need
something to convert that to html or to format the XML, which would be XSL.
I assume therefore that the idea is to store the website contents in XML,
and just format that using either XSL or using PHP to make it into a normal
HTML / XHTML page.
Anyway, generating XML with PHP is just a case of writing it as a file
called .xml instead of .htm (if you are generating static pages using PHP).
You just need to be aware of the tags and make sure the format of the XML is
right otherwise you'll run into all sorts of problems. I find it best to
write a page of what I need just as normal html / xhtml / xml or whatever
and then put in the code to make up that page with PHP dynamically.
If you have the XML on the server, and want to read it into PHP which will
use the values to output to a standard HTML page then you'll need to use the
xml functions of PHP. I assume thats the bit you've been reading up on. It
takes a while to get the hang of it, but I actually went through the same
thing last night, going from having never even really looked at an XML
document to writing them, and using them in a PHP page in a little under 5
hours. The reason for using it in PHP and outputting a standard page means
that it will have less possible problems - not sure if that would count as
using XML in your case. Basically, this uses it for storing the data, but
your project may require you to use it to actually serve the data too, in
which case you'd have to generate the XML, and then use an XSL page to
format it clientside.
Hope this is some help - if you can provide an example of what you need to
store, where you need to use XML, and what is in your database and what is
regenerated each page, then I might be able to offer more specific advice.
David