Welcome Guest, Not a member yet? Register   Sign In
Fatal error: Call to undefined function: base_url()
#1

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

<a href="&lt;?=base_url();?&gt; ">A</a>

Chris
#2

[eluser]Michael Wales[/eluser]
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
#3

[eluser]floweringmind88[/eluser]
AH thanks soo much!
#4

[eluser]floweringmind88[/eluser]
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?
#5

[eluser]Maks Baum[/eluser]
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.
#6

[eluser]krwl[/eluser]
[quote author="floweringmind88" date="1211924419"]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?[/quote]

did you pass the variables when loading view?

Code:
$vars['one'] = "blabla";
$this->load->view('filename', $vars);

and in the view
Code:
&lt;?= $one ?&gt;




Theme © iAndrew 2016 - Forum software by © MyBB