I have a large site with multiple templates which contain some text which i would like to hide on ALL pages unless i have ticked a checkbox (a bit like navigation structure where you can hide selected items from appearing on menus).
The div in the template is
<div class="someclass">Text that should NOT appear unless a tick box is ticked</div>
Im using XSLT and wondered how i could do this? Or any other way to achieve the same?
This is indeed possible — if your checkbox has the alias showSecretInfo you can do something like this:
<xsl:if test="$currentPage[showSecretInfo = 1]">
<div class="someclass">Text that should NOT appear unless a tick box is ticked</div>
</xsl:if>
Now, if the showSecretInfo checkbox only exists on e.g. the root node, you can do a recursive lookup, like this:
<xsl:if test="$currentPage/ancestor-or-self::*[showSecretInfo = 1]">
<div class="someclass">Text that should NOT appear unless a tick box is ticked</div>
</xsl:if>
Hide text according to value
I have a large site with multiple templates which contain some text which i would like to hide on ALL pages unless i have ticked a checkbox (a bit like navigation structure where you can hide selected items from appearing on menus).
The div in the template is
Im using XSLT and wondered how i could do this? Or any other way to achieve the same?
Thanks
Hi J,
This is indeed possible — if your checkbox has the alias
showSecretInfo
you can do something like this:Now, if the
showSecretInfo
checkbox only exists on e.g. the root node, you can do a recursive lookup, like this:Hope that helps,
/Chriztian
is working on a reply...