CodeIgniter Forums
Error Accessing Cookie Helper? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Error Accessing Cookie Helper? (/showthread.php?tid=25672)



Error Accessing Cookie Helper? - El Forum - 12-20-2009

[eluser]Vik[/eluser]
I must be making some very obvious error here.

Code:
$this->load->helper('cookie');
$S = $this->cookie->get_cookie('cookie_name');

No error is thrown by the load->helper line, but the next line throws the error:

Quote:Call to a member function get_cookie() on a non-object

What am I missing?

UPDATE: Oh - you just have to say get_cookie, not $this->cookie->get_cookie. Smile


Error Accessing Cookie Helper? - El Forum - 12-20-2009

[eluser]Aken[/eluser]
Yup, helpers are stand-alone functions that are not part of a class, so they are called by themselves, same as a standard PHP function is used.