Jump to:

23479 Posts in 18951 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Stage and Live modes; does a cookie get saved?

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: 1374 Views
  • dynamite
    Avatar
    Community Member
    66 Posts

    Stage and Live modes; does a cookie get saved? Link to this post

    Hello,

    I was wondering if a cookie or session variable is being set when switching between Draft (aka Stage) and Live mode when viewing the site as a logged in admin?

    If so, how I can call a a preview of a page without "switching" to that mode? For example, is there a special GET string I can add on the end like this?

    http://localhost/new-page/?stage=Stage&savestate=false

    I am guessing that this may take some poking around in the internals of SS, but wanted to throw it out there to the community and see if anyone else has run into a situation like this before.

    Thanks!

    Jeremy

  • Willr
    Avatar
    Forum Moderator
    5502 Posts

    Re: Stage and Live modes; does a cookie get saved? Link to this post

    Yes it is stored in a cookie (or session). In order to switch page you must change the GET variable back to the 'live'. No built in way to override this cookie.

  • dynamite
    Avatar
    Community Member
    66 Posts

    Re: Stage and Live modes; does a cookie get saved? Link to this post

    Thanks willr.

    Could you point me in the right direction if I wanted to try and modify some of the core SS files to turn this off?

    Thanks again! ...Jeremy

  • Willr
    Avatar
    Forum Moderator
    5502 Posts

    Re: Stage and Live modes; does a cookie get saved? Link to this post

    See the choose_site_stage() function in Versioned.php Line 577.

  • merrick_sd
    Avatar
    Community Member
    95 Posts

    Re: Stage and Live modes; does a cookie get saved? Link to this post

    http://mydomain.co.uk?stage=Stage   ;

    <% if current_stage == "Stage" %>

    // $current_stage
    //YES do this
    <% else %>

    ESLE do that
    <% end_if %>

    YES is always true even if i do http://mydomain.co.uk
    result //Live Yes do this

    something wrong with my if syntax

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