I know this has been discussed, but for the life of me I cannot figure this one out.
I'm using Umbraco v4 and I need a content item to redirect to an external URL. How would I go about doing this?
What I've tried: Neehouse Redirect, umbRedirect and some advice I found in a few threads regarding doc type and xslt. So far nothing has worked and my frustration is building.
Can someone point me in the right direction or maybe spell it out clearly in this thread?
<xsl:otherwise> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id"> <!-- we're under the item - you can do your own styling here --> <xsl:attribute name="class">current</xsl:attribute> </xsl:if> <xsl:value-of select="@nodeName"/> </a> </xsl:otherwise> </xsl:choose>
<!-- Input the documenttype you want here --> <!-- Typically '1' for topnavigtaion and '2' for 2nd level --> <!-- Use div elements around this macro combined with css --> <!-- for styling the navigation --> <xsl:variable name="level" select="1"/>
<xsl:template match="/">
<!-- The fun starts here --> <ul id="menu"> <xsl:for-each select="$currentPage/ancestor-or-self::node [@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1']"> <li>
<xsl:otherwise> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id"> <!-- we're under the item - you can do your own styling here --> <xsl:attribute name="class">current</xsl:attribute> </xsl:if> <xsl:value-of select="@nodeName"/> </a> </xsl:otherwise> </xsl:choose>
<!--If a node has children, show them on hover--> <xsl:if test="($currentPage/@id and count(current()/node) > 0) or ($currentPage/@parentID = ./@id)"> <ul id="submenu"> <xsl:for-each select="current()/node"> <li> <xsl:choose> <xsl:when test="./data [@alias='externalLink'] = 1"> <a href="{./data [@alias='link']}" target="_blank"> <xsl:value-of select="@nodeName"/> </a> </xsl:when>
<xsl:otherwise> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id"> <!-- we're under the item - you can do your own styling here --> <xsl:attribute name="class">current</xsl:attribute> </xsl:if> <xsl:value-of select="@nodeName"/> </a> </xsl:otherwise> </xsl:choose> </li> </xsl:for-each> </ul> </xsl:if> </li> </xsl:for-each> </ul>
Redirect to URL
I know this has been discussed, but for the life of me I cannot figure this one out.
I'm using Umbraco v4 and I need a content item to redirect to an external URL. How would I go about doing this?
What I've tried: Neehouse Redirect, umbRedirect and some advice I found in a few threads regarding doc type and xslt. So far nothing has worked and my frustration is building.
Can someone point me in the right direction or maybe spell it out clearly in this thread?
Thanks,
Jeremy
Can you post the xslt you tried? Should be fairly easy to setup.
HTH,
PeterD
Sure. It's based on this post.
In my document type I have two fields:
External Link; Alias:externalLink; Type: true/False
Link; Alias: link; Type: Textstring
XSLT:
[code]
[/code]
ah, so you have a property in your document and not a documenttype itself
Change this line:
[code]
That worked. Thank you.
nice one
Just what i needed, works great
might as well post my xslt as it also contains subpages and the above does not. Just to help others :-)
doh! Here's the right code lol
This code is obsolete with the new 4.5 xml schema
To access nodes, data is no longer valid, to fix it I did:
is working on a reply...