Copied to clipboard

Flag this post as spam?

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


  • DotNetPervert 18 posts 34 karma points
    Jan 20, 2010 @ 23:49
    DotNetPervert
    0

    How to render href from a document property?

    Hi guys,

    this is probably a silly question but I want to render an email (mailto:) link on the contact us page so that the email address comes from the umbraco document type field.

    Of course the most straight forward approach for me was to write it this way:

    <div><strong>Email:</strong> <a href="mailto:<umbraco:Item field="email" stripParagraph="true" convertLineBreaks="true" runat="server"></umbraco:Item>"><umbraco:Item field="email" stripParagraph="true" convertLineBreaks="true" runat="server"></umbraco:Item></a></div>

    However this renders like so in HTML:

    <div><strong>Email:</strong> <a href="" mailto:=""><umbraco:item" field="email" stripparagraph="true" convertlinebreaks="true"></umbraco:item">"&gt;[email protected]</a></div>

    Which of course is totally incorrect. How do I avoid this from happening? Do I need to be escaping double quotes in href or something? How would I do that?

    Thanks in advance guys!

  • DotNetPervert 18 posts 34 karma points
    Jan 21, 2010 @ 00:20
    DotNetPervert
    0

    Just a note, I'm doing all this within a template, I would rather not write a macro for something this trivial if it can be avoided.

    Thank you.

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Jan 21, 2010 @ 00:34
    Morten Bock
    0

    In the dialogue when inserting the umbraco:item you can select something to insert before and after the field. That should let you create the opening link tag

  • DotNetPervert 18 posts 34 karma points
    Jan 21, 2010 @ 02:20
    DotNetPervert
    0

    Great, thank you for your help!!!

Please Sign in or register to post replies

Write your reply to:

Draft