Copied to clipboard

Flag this post as spam?

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


  • Claushingebjerg 886 posts 2415 karma points
    Apr 07, 2009 @ 13:16
    Claushingebjerg
    0

    getting a media folder name from id

    How do i get the name of a folder located in the media section from it s ID?

    Example:
    i have a folder called "instruments" with an id of "1262"

    How do i get umbraco to render "instruments" instead of "1262".

    Any help is appreciated. Thanks

  • Daniel Lindstrom 454 posts 271 karma points
    Apr 07, 2009 @ 13:19
    Daniel Lindstrom
    0

    Folder is a media type just like Image or File, so you should be able to use Getmedia to get the xml for the folder.

  • Claushingebjerg 886 posts 2415 karma points
    Apr 07, 2009 @ 13:23
    Claushingebjerg
    0

    thats what i thought, but

    [code]

    [/code]

    renders all the files insdide the folder, and not the folder name...

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Apr 07, 2009 @ 13:23
    Dirk De Grave
    0

    Hi,

    new Node(1262).Text or umbraco.library:GetXmlNodeById(id)/@nodeName

    (Not sure which option you've choosen, xslt or user control?)

    Regards,
    /Dirk

  • Daniel Lindstrom 454 posts 271 karma points
    Apr 07, 2009 @ 13:32
    Daniel Lindstrom
    0

    [quote=Claushingebjerg]thats what i thought, but

    [code]

    [/code]

    renders all the files insdide the folder, and not the folder name...[/quote]

    Yes that is by design. You have to look for the nodeName attribute:



    Sorry for not being clear enough.

  • Claushingebjerg 886 posts 2415 karma points
    Apr 07, 2009 @ 13:39
    Claushingebjerg
    0

    Thanks again, but

    [code]

    [/code]

    Doesn't return anything.

    But if i swap the id with an id of a content node (1047) it returns the nodename just fine?!?!


    Just to clear things up, im using xslt. NOT usercontrol

  • Claushingebjerg 886 posts 2415 karma points
    Apr 07, 2009 @ 13:40
    Claushingebjerg
    0

    Thanks Daniel, that did the job

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies