xslt - How do you only display a piece of a template on certain pages in Umbraco CMS? -


i have site built umbraco has sidebar several widgets setup. need set 1 of widgets (done xslt) display on page. i've looked @ using xsl:if test , matches , can't figure out.

you're on right track, habit of including have tried in question (code etc).

the quick + dirty method

find out id of page (found on properties tab of node in content section) , use following code:

<xsl:if test="$currentpage/@id = 1234">     <!-- widget here --> </xsl:if> 

the cleaner method

always try build code scalable, instance may find want include widget on page in future, or deploying content staging production might involve node ids changing without realizing (not often, can happen).

add property page in question (let's call showmyfancywidget) true/false data type, flick on in content section use following code:

<xsl:if test="$currentpage/showmyfancywidget = 1">     <!-- widget here --> </xsl:if> 

this code work umbraco v4.5.1 onwards. not sure v5, that's being discontinued in favor of v4.7 anyway


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -