Copied to clipboard

Flag this post as spam?

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


  • dominik 711 posts 733 karma points
    Mar 24, 2011 @ 12:21
    dominik
    0

    Store cookie in XSLT

    Hello,

    Ive got a banner xslt script which shows a banner on a specific page.

    Now i want to add a property called "Show only once"

    If this property is set to true the banner should only be shown once.

    I think the best method to do this is to store a cookie and look if the cookie still exists

    Anybody any idea how to handle this?

     

    Thanks

  • Rich Green 2246 posts 4008 karma points
    Mar 24, 2011 @ 12:35
    Rich Green
    1

    Hi,

    You can retrieve the cookie in XSLT using 

      <xsl:value-of select="umbraco.library:RequestCookies('nameOfCookie')"/>

    Rich

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 24, 2011 @ 12:44
    Jan Skovgaard
    0

    Hi Dominik

    You could also consider using the jquery.Cookie plugin to create the cookie - read more about the plugin usage here: http://www.electrictoolbox.com/jquery-cookies/

    /Jan

  • dominik 711 posts 733 karma points
    Mar 24, 2011 @ 12:52
    dominik
    0

    yes i got it but how can i get any umbraco media type id into this cookie ?

    i tryed the following:

    $.cookie("banner-layer", "<xsl:value-of select="$mediaNode" />", { expires: 7 });

    But the cookie value is null

     

    Thanks

  • dominik 711 posts 733 karma points
    Mar 24, 2011 @ 12:58
    dominik
    0

    ok it works now - sorry

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 24, 2011 @ 17:49
    Jan Skovgaard
    0

    Hi Dominik

    Happy to hear you got it solved.

    Are you using the xslt extension to read the cookie or do you use the cookie plugin for that? (Being curious :))

    /Jan

  • dominik 711 posts 733 karma points
    Mar 24, 2011 @ 19:10
    dominik
    0

    I read and store the cookie via xslt an jquery inside the XSLT and it works great

    Thanks for your help

  • 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