EllisLab text mark
Advanced Search
     
Fatal error: Call to undefined function: base_url()
Posted: 27 May 2008 01:23 PM
Avatar
Joined: 2008-05-27
29 posts

When I call base_url() in my view I get a fatal error. I am running php4, would that be the problem?

A

Chris

 
Posted: 27 May 2008 01:28 PM   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2007-07-30
2144 posts

base_url() is part of the URL helper. Either load it from within the Controller or load it automatically (my preference based on how much I use the functions contained within) via config/autoload.php

 Signature 

Follow me on twitter here.
MichaelWales.com | MichaelWales.info

 
Posted: 27 May 2008 01:31 PM   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-27
29 posts

AH thanks soo much!

 
Posted: 27 May 2008 01:40 PM   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-27
29 posts

By the way none of my variables are appearing in my view. Is there another file I need to autoload so I can access my variables in the view?

 
Posted: 28 May 2008 06:50 AM   [ # 4 ]   [ Rating: 0 ]
Joined: 2007-12-22
15 posts

My sollution to have some base url is just create in eg MY_Controller (from which all my controllers inherit) and in the variable which is a table of varaibles given to output put [‘base_url’] so in every view now I just have $base_url And I don’t have to load and additional classes (URL helper).
This is not a problem becouse I always have to give some variables into view, so one variable doesn’t make controllers code less clear.

 
Posted: 28 May 2008 09:44 AM   [ # 5 ]   [ Rating: 0 ]
Joined: 2007-05-02
3 posts
floweringmind88 - 27 May 2008 05:40 PM

By the way none of my variables are appearing in my view. Is there another file I need to autoload so I can access my variables in the view?

did you pass the variables when loading view?

$vars['one'"blabla";
$this->load->view('filename'$vars); 

and in the view

<?$one ?> 
 Signature 

Aldiantoro Nugroho
http://littlebrain.org