index.php - works - index.php/home - does not - Please help explain |
[eluser]ICEcoffee[/eluser]
Hi Folks I have on my local server a directory called ci2. I have setup a default controller called home.php. I have in my config file: Code: $config['base_url'] = "http://127.0.0.1/ci2/"; My default controller (home) is this: Code: <?php My View file mentions in the above code is this (head section only): Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> The problem? if I type into my browser: http://localhost/ci2/ or http://localhost/ci2/index.php, I see the referenced stylesheet. If I type: http://localhost/ci2/index.php/home/ I DO NOT SEE THE STYLESHEET. Can someone explain what is happening. Thank you.
[eluser]stuffradio[/eluser]
I'm not too sure right now, but you have a space after $data['name'] = "brian" ; Try removing that.
[eluser]Merolen[/eluser]
Doesn't the base_url have to be there? I you don't specify it it is relative to the URL you see in your URL field. Code: <link rel='stylesheet' href="<?=base_url()?>styles/style.css" type='text/css' media='screen' charset='utf-8' />
[eluser]Brandon Dickson[/eluser]
Merolen's correct, CI uses url routing to make things cleaner, but to your web browser, when you type in: http://localhost/ci2/index.php/home/ the browser assumes that "home" is a directory, so its looking for you css file here: http://localhost/ci2/index.php/home/styles/style.css try using site_url('styles/style.css') or base_url() as Merolen described. -Brandon
[eluser]ICEcoffee[/eluser]
The previous two posts sounds 'bang on the money'. It's seems the 'logical' action to use. I don't know why I didn't think of it. :red: Thanks guys, I'll give that a go later. |
Welcome Guest, Not a member yet? Register Sign In |