Copied to clipboard

Flag this post as spam?

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


  • Rage 4 posts 24 karma points
    Feb 08, 2012 @ 11:10
    Rage
    0

    library urls / links in umbraco 5

    I'm trying to create a link... I've created a new document type, and added a link text property. Within my template I'm getting these objects fine, but the link does not work (the links are appearing on the page):

    @foreach(var child in @DynamicModel.Children)

    {

    <h1>linkText </h1>

    <a href="/@child.pdf">@child.linkText</a>

    }

     

    In umbraco 4, there were library helpers, and I think this would have worked:

     @umbraco.library.NiceUrl(child.pdf )

    but this is not working. 

    I see the uploaded file within the cms, and follow the link.. it goes to:

    http://localhost/Content/Media/89ffb6e6704a4ce5bd2cd5784b56bc5a/lesson-plan-ks3.pdf

    however the page link (from code above) goes to:

    http://localhost/media$empty_root$$_p__nhibernate$_v__guid$_3b6fb6f6b36e4b0babf49ff00107ffb7

    I'm trying to link to a new media type called "pdf" type which is setup in the media section. 

    Any help appreciated. 

     

    Thanks

  • Rage 4 posts 24 karma points
    Feb 08, 2012 @ 11:39
    Rage
    0

    ... Just got the answer... it is:

    var pdfURL = Umbraco.GetMediaUrl(child.pdf, "uploadedFile");

    <a href="@pdfURL">@child.linkText</a>

     

    Thank you Mr Buckley

    https://gist.github.com/1706821

Please Sign in or register to post replies

Write your reply to:

Draft