Copied to clipboard

Flag this post as spam?

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


  • eneunaber 10 posts 64 karma points
    Jul 31, 2009 @ 05:12
    eneunaber
    0

    Referencing Media Files

    All,

    I apologize for what may be a very simple question, but I'm putting together a fairly simple site. I have created a "downloads" folder under the media folder and the idea was to place some pdf forms under this folder.  I would like to link to these files from within my pages. What is the best way too accomplish this?

    I was hoping there would be an equivelant to this feature: <umbraco:Macro Alias="Navigation" runat="server"></umbraco:Macro> 

    And I would just change the tags around and it would automatically generate a link to my file for me.

    Thanks for taking the time to answer my question.

    - e r i c

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jul 31, 2009 @ 08:03
    Sebastiaan Janssen
    102

    If you have uploaded the files through the media section in the backoffice then it could not be easier:

    In you rich text editor, there's a button to insert links. Go to the media tab and pick the correct file.

    Also, if you don't want to link the files from within the editor, you could choose to have a media picker on your document type and choose the correct file there. In your template it's a little bit tricky, as you can read in this wiki page.

    In your XSLT you could link to it like this (if you give the media picker an alias of "pdfFile":

    <xsl:if test="./data [@alias = 'pdfFile'] != ''">
    <a href="{umbraco.library:GetMedia(./data [@alias = 'pdfFile'],'false')/data [@alias = 'umbracoFile']}">Download PDF</a>
    </xsl:if>
  • eneunaber 10 posts 64 karma points
    Aug 01, 2009 @ 14:56
    eneunaber
    0

    Thank you very much for the reply and the answer. I normally don't use WSYWYG editors, so I never even looked at using it.  But really it's pretty straight forward.

  • Diego Melgarejo 4 posts 24 karma points
    Aug 27, 2009 @ 22:09
    Diego Melgarejo
    0

    What if after build the link I decide change the document version?

    Actually, If I do that, the page stills points to the old document name. How can I update automatically the link reference if I change the media Node?

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft