View Full Version : loading xml into an html page

Craig Dorricott
12-07-2008, 01:22 PM
Hi all.

I am very new to website designing and have no primary knowledge of coding.

I am wondering if it is possible to load random content from an xml file into a div tag in an html page?

The reason for me asking is that I am wanting to load testimonials into an area on my site(which I have not built yet) so that they change either on load or one for every day. Just to give my site some dynamic content.

Or if anyone knows away I can do this in an easier or more effective way please can you say.

Thanks in advance.


12-07-2008, 05:56 PM
PHP has an excellent object made just for that: simplexml_load_file

This'll show you how to use it as a function to pull in a file: http://us.php.net/manual/en/function.simplexml-load-file.php

For your purposes I would suggest creating a separate PHP file for your testimonials that updates whenever you want it to, then all your other pages on your website that want to utilize those testimonials can AJAX that central page into their own.