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, biapar, Willr, Ingo, swaiba, simon_w

Homepage controller cookie not set


Reply


2 Posts   778 Views

Avatar
PeltierEffects

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.

Avatar
PeltierEffects

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.