Welcome Guest, Not a member yet? Register   Sign In
Accessing $config['base_url'] in views
#1

[eluser]europe72[/eluser]
Working on a prod and dev environment where I need to write a sepearte base href into my XHTML view files depending on whether code is on prod or dev. Easiest way for me to do this is to use the existing value of $config[base_url] from config file in app, but I can't seem to figure out how to get that value into my views. The value does not seem to be available at the controller level or I could simply pass it to the view in the controller. Ideally I want the following...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;title&gt;Hello World!&lt;/title&gt;
&lt;base href="&lt;?php echo $VALUE_OF_CONFIG_BASE_URL_PLEASE; " /&gt;


Thanks
#2

[eluser]m4rw3r[/eluser]
From the URL helper manual:

base_url()

Returns your site base URL, as specified in your config file. Example:
echo base_url();

I guess it was that you were after.
#3

[eluser]europe72[/eluser]
Ah, I missed that. THANKS! :-)




Theme © iAndrew 2016 - Forum software by © MyBB