Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am a little rusty on how you would check for wheather a node has an attribute and wheather it is "true".
If the attribute is "true", then I would like to add ''target="_blank' to the <a> associated with it.
Help?
Hi Steve,
Here is the documentation on using the true/false property editor.
http://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/built-in-property-editors/True-False
<xsl:if test="string(umbracoNaviHide) = '1'"> <xsl:attribute name="target"> _blank </xsl:attribute></xsl:if>
Where the umbracoNaviHide is the propertyAlias of the true / false field
Hope this helps,
/Dennis
Hi Steve/Dennis,
Actually, there's no need to do the string conversion - this will work just fine:
<xsl:if test="umbracoNaviHide = 1">
- Looks much better too, if you ask me :-)
Be sure to always test for equality, though - or use the not() function to test for inequality, e.g.:
<xsl:if test="not(umbracoNaviHide = 1)">
This takes care of edge cases where the property doesn't exist...
/Chriztian
I am sorry, I guess I wasn't clear. I don't rember how to properly access and change an attribute such as "target" on a href, if the test for a node property is equal to "true". Here is what I have so far:
<xsl:if test="$node != ''"> <a> <xsl:attribute name="href"> <xsl:choose> <xsl:when test="$node[name() = 'ExternalLink']"> <xsl:value-of select="$node/url" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="umbraco.library:NiceUrl($node/@id)" /> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:attribute name="target"> <xsl:if test="externalUrl = '1'"> <xsl:value-of select="@target"> </xsl:attribute> <span> <xsl:call-template name="node-name"> <xsl:with-param name="node" select="$node" /> </xsl:call-template> </span> </a> </xsl:if>
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Check for Boolean Attribute on Node
I am a little rusty on how you would check for wheather a node has an attribute and wheather it is "true".
If the attribute is "true", then I would like to add ''target="_blank' to the <a> associated with it.
Help?
Hi Steve,
Here is the documentation on using the true/false property editor.
http://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/built-in-property-editors/True-False
Where the umbracoNaviHide is the propertyAlias of the true / false field
Hope this helps,
/Dennis
Hi Steve/Dennis,
Actually, there's no need to do the string conversion - this will work just fine:
- Looks much better too, if you ask me :-)
Be sure to always test for equality, though - or use the not() function to test for inequality, e.g.:
This takes care of edge cases where the property doesn't exist...
/Chriztian
I am sorry, I guess I wasn't clear. I don't rember how to properly access and change an attribute such as "target" on a href, if the test for a node property is equal to "true". Here is what I have so far:
is working on a reply...