Jump to:

23364 Posts in 18125 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » Getting / Setting a value from js into the template

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 414 Views
  • steve_nyhof
    Avatar
    Community Member
    224 Posts

    Getting / Setting a value from js into the template Link to this post

    I'm not sure about what I need here or how to really ask the question...

    I am setting a cookie (sneAlertCookie) to allow a visitor to a second page, but only one time. If they return to this second page, they are brought to another page - this is all working.

    I have an alert box on the first page for first time visitors. If they travel to the second page (above) a cookie is set on their computer. If they leave and return to this second page, the system redirects them to the page of my choice. Again all working.

    If a visitor comes back to the site on the first page (the one with the alert box), I want to get a value from their cookie and use it on this page to in an IF to turn the alert off.

    var value == sneAlertCookie; //from client cookie - does it exist

    ...

    <% if sneAlertCookie == value %>

    How do I get a value from javascript or set in the php file for this page type (AlertPage) ??

    Anyone with some great knowledge offer some ideas and help here?

    Thank you,
    Steve

    414 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.