CodeIgniter Forums
redirect() throwing error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: redirect() throwing error (/thread-6584.html)



redirect() throwing error - El Forum - 03-04-2008

[eluser]VirtualDevel[/eluser]
Hi guys, I get the following error when I call redirect() :

Quote:Fatal error: Call to a member function site_url() on a non-object in /var/www/vhosts/[host-name]/httpdocs/system/helpers/url_helper.php on line 45

Here is the code in the controller:
Code:
if ($this->do_upload()) {
   redirect('/admin/stuff/editor', 'refresh');
}

Not sure why I am getting this, any ideas?


redirect() throwing error - El Forum - 03-04-2008

[eluser]VirtualDevel[/eluser]
Wow, ok, I got it, was calling:

Code:
// Constructor
function Stuff() {
parent::Controller();

$this->config =& get_config();

In my constructor, as I had some vars set there. Removing that resolved the issue..hmm


redirect() throwing error - El Forum - 03-04-2008

[eluser]Seppo[/eluser]
Just to clarify why, the controller attribute "config" is reserved to hold the ci config object.


redirect() throwing error - El Forum - 03-04-2008

[eluser]VirtualDevel[/eluser]
Thanks..appreciate the explination Smile