Copied to clipboard

Flag this post as spam?

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


  • Simon 24 posts 64 karma points
    Jul 16, 2010 @ 11:53
    Simon
    0

    Using a text string in content manager to add URL

    Hi guys, i have created a text field called URL in Generic Properties tab in Document Types and i am trying to get it so that the user can type in the URL and it will place it on the page. What i want to know is, how do I use the text field within the <A Href=..." tag? I have tried all sorts including setting a variable to equal the alias URL and nothing seems to work other than hard coding the URL.

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jul 16, 2010 @ 11:58
    Kim Andersen
    0

    Hi Simon

    Try something like this:

    <xsl:variable name="link" select="$currentPage/data[@alias='URL']"/>
    <a href="{$link}">Linktext</a>

    The above code will grab the value from the textfield called "URL" and put into the href-attribute.

    If you use the new XML schema the xslt will look like this:

    <xsl:variable name="link" select="$currentPage/URL"/>
    <a href="{$link}">Linktext</a>

    Was this what you where looking for?

    /Kim A

  • Simon 24 posts 64 karma points
    Jul 16, 2010 @ 12:10
    Simon
    0

    Thanks that works, any idea how to pull this from a sub page of the current page? It used to be that it filled a table in the parent page with page names of the sub pages and link to those pages from the table. I want it to work in the same way as this but to input the URL ourselves rather than it pulling it from the sub page automaticaly. It works with the 'teaser' box i have on the sub page to put a description of it in the right column but it is pulling the URL from the parent.

  • Simon 24 posts 64 karma points
    Jul 16, 2010 @ 12:13
    Simon
    0

    Nm i figured it out i put /node after $currentPage. Thanks for your help Kim, you're a legend.

  • Sam 184 posts 209 karma points
    Dec 04, 2010 @ 16:42
    Sam
    0

    Thanks Kim,

    I needed the exact same thing :)

    Sam.

  • Kim Andersen 1447 posts 2196 karma points MVP
    Dec 04, 2010 @ 16:56
    Kim Andersen
    0

    You are welcome Sam. I think it's great when "older" posts still helps people out there!

    /Kim A

  • Sam 184 posts 209 karma points
    Dec 04, 2010 @ 17:04
    Sam
    0

    I was thinking the same thing. Been on the forum all day whilst doing my personal website, you can learn so much in here from so many talented people. The major difference between here and other forums I find is that people here are patient and haven't forgotten that at one point, they also knew nothing about xslt... and now they don't mind sharing their knowledge! Which makes for a sweet forum and another reason why umbraco rules!! :))

    Sam.

Please Sign in or register to post replies

Write your reply to:

Draft