• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error with base_url()

#1
Hi everyone, 

I'm actually trying to put online my website.
In local, everything goes fine, but when i send my files on the server (one.com), this message appear when i go to the site: 

"An uncaught Exception was encountered

Type: Error
Message: Call to undefined method CI_Controller::base_url()
Filename: /customers/f/1/b/onsen.be/httpd.www/application/views/errors/html/error_404.php
Line Number: 9
Backtrace:
File: /customers/f/1/b/onsen.be/httpd.www/index.php
Line: 315
Function: require_once"


And there is my error_404.php file:

"<?php



$CI =& get_instance();

if( ! isset($CI))

{

    $CI = new CI_Controller();

}

$CI->load->helper('url');

echo $CI->base_url();
?>
"
I'm working with Codeigniter 3.0.6

Can someone help me with this ? 
It's relly important for me to fix this as soon as possible.

Thanks for the help ! 
Reply

#2
(06-07-2017, 10:45 AM)dashing Wrote: Hi everyone, 

I'm actually trying to put online my website.
In local, everything goes fine, but when i send my files on the server (one.com), this message appear when i go to the site: 

"An uncaught Exception was encountered

Type: Error
Message: Call to undefined method CI_Controller::base_url()
Filename: /customers/f/1/b/onsen.be/httpd.www/application/views/errors/html/error_404.php
Line Number: 9
Backtrace:
File: /customers/f/1/b/onsen.be/httpd.www/index.php
Line: 315
Function: require_once"


And there is my error_404.php file:

"<?php



$CI =& get_instance();

if( ! isset($CI))

{

    $CI = new CI_Controller();

}

$CI->load->helper('url');

echo $CI->base_url();
?>
"
I'm working with Codeigniter 3.0.6

Can someone help me with this ? 
It's relly important for me to fix this as soon as possible.

Thanks for the help ! 

echo base_url();

Helpers don't usually add methods to the CI object.
Reply

#3
echo base_url();

Helpers don't add methods to the CI object.
Reply

#4
(06-07-2017, 11:43 AM)greywolf Wrote: echo base_url();

Helpers don't add methods to the CI object.

Thanks for the help.
But now, nothing appear, only a blank page  Sad

Any idea ?
Reply

#5
(06-08-2017, 02:42 AM)dashing Wrote:
(06-07-2017, 11:43 AM)greywolf Wrote: echo base_url();

Helpers don't add methods to the CI object.

Thanks for the help.
But it still not working Sad

Now i have a 404 error.

Any idea ?
Reply

#6
If you need another Controller create a MY_Controller and extend from that.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#7
Problem solved.

It was an error with my controller name.
It must start with a capital letter...

All this sh*t for one letter lol

Thanks for those who reply me ;-)
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.