3

How do I create a PHP file that returns a list of nodes as XML when called if I have a menu structure like this:

<GalleryXML>
--gallery 1
---Item 1
---Item 2
---Item 3

And I want a url like localhost/getgallery.php

this url will then return my gallery as xml, something like this

<galleryXML>
    <gallery name="gallery1">
        <item name="item1">
            <image>localhost/site/default/image1</image>
            <imagethumb>localhost/site/default/image1</imagethumb>
            <url>http://google.com</url>
            <description>lorum ipsom</description>
        </item>
    </gallery>
</galleryXML>

Where Image, Imagethumb, url and description are fields on the item node

Thanks in Advance!

1

1 Answer 1

6

This is what i did:

  1. I created a view.
  2. Changed the style to XML data document (Need to download the Views Datasource module)
  3. Added the fields I needed and Nodequeue
  4. Added a filter to filter by node type so it looks like this:

Views settings then I added a new page with a path:

Page settings

my end result looks like this:

 <node>
    <node>
        <Description>blablalbla</Description>
        <Image>
        sites/default/files/articles/siteadmin/test.png
        </Image>
        <ImageBig>sites/default/files/test.png</ImageBig>
        <Link>derp</Link>
        <gallery>Gallery1 For flash</gallery>
    </node>
    <node>
        <Description>sdfsdfdf</Description>
        <Image>
        sites/default/files/articles/siteadmin/test.png
        </Image>
        <ImageBig>sites/default/files/test.png</ImageBig>
        <Link>sdfdf</Link>
        <gallery>Gallery2 For flash</gallery>
    </node>
</node>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.