Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

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

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

Homepage controller cookie not set

Go to End

2 Posts   1146 Views


Community Member, 6 Posts

9 April 2011 at 5:28pm

Okay, on my page controller I set a cookie to pass information. But when someone enters via the homepage no cookie gets set. Not even the SS pastmember cookie. So it's not just my cookie, not cookie gets set on the visitor entering the site on the homepage. Entering on any other page all cookies get set no problem, even the SS pastmember cookie is good.

I've debugged the code an see the set cookie is getting executed but no cookie. Again entering on another page with the indentical cookie code works well.


Community Member, 6 Posts

21 April 2011 at 4:40pm

Edited: 21/04/2011 5:47pm

Okay, figured it out on an Ah Ha moment

At the top of the HomePage.php was a blank line before <?php

You can't do that. There must be NO output before the setcookie and a blank line is output. Normally you'd get a big error, but silverstripe hides the setcookie errors.