Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Max 144 posts 166 karma points
    Apr 05, 2011 @ 12:00
    Max
    0

    hide div item from xslt

    I have a <div > element consisting of umbraco:Item field the Body Text but i want to hide the <div> it when there is a parameter passed with umbraco.library:RequestQueryString in the xslt file

    any code example wil be useful

     

     

  • Rich Green 2246 posts 4008 karma points
    Apr 05, 2011 @ 12:06
    Rich Green
    0

    Hi Max,

    Create an XSLT macro and use the following code

    <xsl:choose>
    <xsl:when test="umbraco.library:RequestQueryString('yourKey')">
    Your code without the DIV here
    </xsl:when>
    <xsl:otherwise>
     Your code with the DIV here
    </xsl:otherwise>
    </xsl:choose>

    Rich

  • Max 144 posts 166 karma points
    Apr 05, 2011 @ 12:25
    Max
    0

    the problem is the div is in Tempolates content page  umbraco:Item field  for teh BODYTEXT is within that div is there anyway we can have access to it when the page refreshes it shos back again

     

  • Rich Green 2246 posts 4008 karma points
    Apr 05, 2011 @ 12:31
    Rich Green
    0

    Just replace the umbraco:item field for a XSLT macro, then with there you use your bodyText property

    http://blog.percipientstudios.com/2009/5/5/your-first-umbraco-xslt-macro.aspx

    <xsl:choose>
    <xsl:when test="umbraco.library:RequestQueryString('yourKey')">
        <xsl:value-of select="$currentPage/bodyText"/>
    </xsl:when>
    <xsl:otherwise>
        <div><xsl:value-of select="$currentPage/bodyText"/></div>
    </xsl:otherwise>
    </xsl:choose>

    Rich

     

  • 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.

    Continue discussion

Please Sign in or register to post replies