I have a property show link. I will use this because some of the link it should not show any page when a user clicks the 2nd level navigation instead selects on the dropdown menu. But for other links when the user select the link it will show a page.
Your code should work just fine - (all the versions here will yield the same result) - but I'm curious if the conditions match your logic?
The '#' will only replace the href if there's at least one subpage that isn't hidden AND the showLink property isn't set - did you mean OR instead, or am I missing the purpose of the property?
Other than that, there could be a problem if you added the showLink property later, and pages created before that hasn't got their value for it. That's why I'm always using the not(something) syntax instead (which you do for umbracoNaviHide already), so you could try:
<xsl:if test="*[@isDoc][not(umbracoNaviHide = 1)] and not($currentPage/showLink = 1)">
How do I get the property alias in xslt
Hi,
I have a property show link. I will use this because some of the link it should not show any page when a user clicks the 2nd level navigation instead selects on the dropdown menu. But for other links when the user select the link it will show a page.
The show link has a true/false value.
Here's my xslt
<xsl:template match="*[@isDoc]">
<li id="navmain">
<a href="{umbraco.library:NiceUrl(@id)}" id="navMain2">
<xsl:if test="*[@isDoc][not(umbracoNaviHide = 1)] and $currentPage/showLink = 0">
<xsl:attribute name="href">#</xsl:attribute>
</xsl:if>
<xsl:value-of select="@nodeName" />
</a>
<xsl:if test="*[@isDoc][not(umbracoNaviHide = 1)]">
<ul>
<xsl:apply-templates select="*[@isDoc]" />
</ul>
</xsl:if>
</li>
</xsl:template>
But it still show the link even if I set it to false in the content page.
Hi Sherry,
Hmmm... have you tried comparing with the value in quotes?
and
I think the value it treated as a "string", rather than a numeric.
Cheers, Lee.
How about:
<xsl:if test="not(./umbracoNaviHide = 1) and $currentPage/showLink = 0">
and
<xsl:if test="not(./umbracoNaviHide = 1)">Hi Sherry,
Your code should work just fine - (all the versions here will yield the same result) - but I'm curious if the conditions match your logic?
The '#' will only replace the href if there's at least one subpage that isn't hidden AND the showLink property isn't set - did you mean OR instead, or am I missing the purpose of the property?
Other than that, there could be a problem if you added the showLink property later, and pages created before that hasn't got their value for it. That's why I'm always using the not(something) syntax instead (which you do for umbracoNaviHide already), so you could try:
/Chriztian
Hi Chriztian,
Yes you are right it should have been "OR" instead "AND". :D my bad.
I wasn't looking at my logic but instead I was focusing if I reference the property right.
Thanks guys.
I love umbraco and the very helpful community. It's been only a week since I used umbraco but I'm learning a lot.
Sorry guys,
I tagged this as solved but somehow I still can't display my link properly.
I used the showLink properly in my top navigation because there are links that I don't want to show any page.
example for the hotel links the user should select from the list of hotel and when he clicks the hotel link it won't show anything.
but for the meetings and events, aside from the dropdown list, if the user clicks the meetings and events I will display the home page
for the meetings and events. :D
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.