Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Gary Bronson 137 posts 46 karma points
    Jan 27, 2009 @ 22:21
    Gary Bronson
    0

    Generate XML from a Physical Path

    Is it possible to generate an XML file from a folder that is on the web server but not in Umbraco? I have a folder with a bunch of images in it and I want to create an XML file that will list the URL to them so a custom flash photo gallery can use it.

    Thanks,

    GaryB

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Jan 27, 2009 @ 22:34
    Dan Diplo
    0

    So long as the folder is readable by the web-server user then you should be able to write an ASP .NET handler to enumerate all the files in the folder and generate the XML. Probably best way would be to use an .ashx handler to do this.

  • Gary Bronson 137 posts 46 karma points
    Jan 28, 2009 @ 16:13
    Gary Bronson
    0

    I probably should have been more clear. I was hoping to create an XSLT in umbraco that looks into the physical folder and have it generate the xml. Then I can reference a macro within an umbraco document to display the xml. I'm currently doing this for pages within umbraco but I am trying to do the same thing with a folder on the seb server instead.

    Thanks,

    GaryB

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jan 28, 2009 @ 21:33
    Dirk De Grave
    0

    Hi Gary,

    I'd create a user control that takes the folder as input parameter and uses some of the available .net classes/functions to generate the xml. Add the user control to a macro and it can be used on all pages where it is required.

    Regards,
    /Dirk


  • Gary Bronson 137 posts 46 karma points
    Jan 28, 2009 @ 21:50
    Gary Bronson
    0

    [quote=Dirk]Hi Gary,

    I'd create a user control that takes the folder as input parameter and uses some of the available .net classes/functions to generate the xml. Add the user control to a macro and it can be used on all pages where it is required.

    Regards,
    /Dirk


    [/quote]

    That sounds reasonable so I'll do that.

    Thanks,

    GaryB

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Jan 28, 2009 @ 21:53
    Douglas Robar
    0

    Hi Gary,

    XSLT can't get to the filesystem, so you'll have to look to C# or (gasp) Python to make your macro (yes, you can get to the file system from a Python macro). But more likely, the C# approach is better in the long run. You could either make a .net control or you could make an XSLT extension and then call it from within your xslt macro just like you do the umbraco.library:*() functions or the exslt functions. There are some good resources on making an xslt extension for umbraco that you can find quickly with Google.

    cheers, and nice to see you on the forum again!
    doug.

Please Sign in or register to post replies

Write your reply to:

Draft