I’ve been having some issues using $this->EE->input->cookie() in a template. I have this code:
<?php
echo "'" . $_COOKIE['announcement'] . "' = '" . $this->EE->input->cookie('announcement') . "'";
?>which returns:
'Show' = ''I tried loading the cookie helper and using get_cookie(‘announcement’) and that doesn’t return anything either.
The cookie shows up fine when I look at the browser cookies.
Am I doing something wrong? Thanks!
EDIT: EE 2.3.1
Hmmm, I thought that was it, I think I remember the same thing happening in EE1?
Now I have both announcement and exp_announcement cookies (just while testing). So I have this:
<?php
echo "'" . $_COOKIE['announcement'] . "' = '" . $this->EE->input->cookie('announcement') . "'";
echo "
";
echo "'" . $_COOKIE['exp_announcement'] . "' = '" . $this->EE->input->cookie('exp_announcement') . "'";
?>and that returns:
'Hide' = ''
'Hide' = ''I did that in the previous example with javascript. I now have it in PHP as well:
<?php
setcookie('exp_announcement','Hide');
echo "'" . $_COOKIE['announcement'] . "' = '" . $this->EE->input->cookie('announcement') . "'";
echo "
";
echo "'" . $_COOKIE['exp_announcement'] . "' = '" . $this->EE->input->cookie('exp_announcement') . "'";
?>which returns:
'Hide' = ''
'Hide' = ''Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.