Copied to clipboard

Flag this post as spam?

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


  • Kasper Dyrvig 246 posts 379 karma points
    Jun 20, 2012 @ 08:27
    Kasper Dyrvig
    0

    Only show popup when cookie doesn't have a value

    Hi all,

    I trying to make a popup that only should be visible if a specific cookie doesn't have a value. So far I don't have succes. Can any of you tell me what is wrong?

    <xsl:if test="umbraco.library:RequestCookies('deal') = ''">
      <xsl:value-of select="umbraco.library:setCookie('deal', '1')"/>
      <div class="sd-popup-container">
        <a href="#"><xsl:value-of select="umbraco.library:GetDictionaryItem('Close')"/></a>
        <!--Popup content here-->
      </div>
    </xsl:if>

    Thank you

  • Nigel Wilson 945 posts 2077 karma points
    Jun 21, 2012 @ 22:16
    Nigel Wilson
    0

    Hi Kasper

    Just a guess...

    <xsl:if test="string(umbraco.library:RequestCookies('deal')) = ''">

    Cheers

    Nigel

  • Kasper Dyrvig 246 posts 379 karma points
    Jun 22, 2012 @ 09:57
    Kasper Dyrvig
    0

    Hi Nigel,

    Thank you for taking your time to help me out.

    But I have solved it just now:

      <xsl:variable name="cv" select="umbraco.library:RequestCookies('deal')"/><xsl:value-of select="$cv"/>
      <xsl:if test="$cv != '1'">
        <xsl:value-of select="umbraco.library:setCookie('deal', '1')"/>
        <!--Content here-->
      </xsl:if>

    The trick is to store the cookie value in a variable before asking what it contains.

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

Please Sign in or register to post replies