Forum Moderators: open

Message Too Old, No Replies

Displaying XML image urls in html/php?

         

k1rk

8:58 am on May 8, 2008 (gmt 0)

10+ Year Member



I am working on a site where I am running a xml script to populate fields dynamically on a php page. My question is how can I display images on the page from a xml file, for example.

<image1>../work/example1.jpg</image1>
<image2>../work/example2.jpg</image2>

Is there a simple way to display these as images on my php page? I believe it can be done with xsl however I have no experience with it and have already styled my page with css so would perfer not to have to learn xsl if there is another way. If not Im open to examples.

tomda

9:52 am on May 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, XSL/XSLT is the best straightforward option. It's easy to do, two or three days or research and you are done.

Otherwise, you can use some XML reader/parser (magpieRSS and Smarty).

Another option is the use of Javascript framework (Mootools, Jquery) and but difficult to implement if you are not a real JS geek - although you could use an already made plugin (slideshow, livebox, etc.)

Last option, for the very lazy one, use something like PicLens... Will not show pic in your HTML page but will show all pics in a 3D kind of animated wall.

Tomda

k1rk

11:05 am on May 8, 2008 (gmt 0)

10+ Year Member



Thanks Tomda, I thought xsl might be the best option. Could you direct me to any straight forward xsl tutorials or scripts?

I have heard that its possible in ajax, but again failed to find any suitable examples, I'm really after something that is slim and clean on code. When a simple one line include will write xml text to my page I don't understand why displaying an image should have to be any more bulky, or require rewriting my entire php/css design.

Any good examples or tutorials anyone could recommend would be much appreciated.

Kirk