Jump to content

Display XML with PHP


dougieladd

Recommended Posts

I'm new to coding nevermind XML and PHP. However, I have managed (with the help of 'Jubba') to display the content of an XML file on my PHP page. Now, how do I display a specific item within that XML instead of the whole lot? Thanks in advance. And thanks to Jubba at kirupa.com - who wrote the best tutorial for beginners - you should write a book you're very good at explaining this stuff)

Link to comment
https://forums.phpfreaks.com/topic/39474-display-xml-with-php/
Share on other sites

Not sure I understand.

I have :

• 1 XML file. (basically a txt file with the xml extension)

• 1 php page (called parser.php)

I've uploaded and tested it and GREAT it displays all items in the XML file. Woo Hoo ! However I only want to display 1 item. How do I do that?

 

I basically copied the code on here... http://www.kirupa.com/web/xml_php_parse_beginner.htm and then amended it to point to my XML file. Am i making sense?

 

Thanks

 

D

Link to comment
https://forums.phpfreaks.com/topic/39474-display-xml-with-php/#findComment-190462
Share on other sites

I decided to go with using XSLT fragments using Dreamweaver 8. It's really straight forward.

1. Create a new XSLT Fragment page in DW8. (you will be asked to give the location of the XML file here either local or remote)

2. Then in the Bindings panel in DW8 you will see the XML nodes.

3. Simply drag the nodes onto the screen where you need them.

_ you have created an XSLT Fragment_

 

4. Now create a dynamic page (I'm using php) and insert the fragment you just created here.

5. Dreaweaver creates a directory called 'includes' with some server side code in a a file called "MM XSL Transform class" - this needs to be upoaded to your server also, otherwise it won't work.

6. Upload everything and test in the browser and ta da! it works!

7. You can filter the XML using Xpath Expression builder...which I'm looking at now...

 

Cheers

 

;)

Link to comment
https://forums.phpfreaks.com/topic/39474-display-xml-with-php/#findComment-192008
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.