Path to my css and images only works on my front door |
[eluser]matches[/eluser]
Hello all, I am new to CI but loving it so far. The only issue I have at the moment is all of my css and images show fine on the index of my site but break on other pages. So for instance: here is the css link Code: <link href="public/css/default.css" rel="stylesheet" type="text/css" /> This urls looks fine http://localhost/testSite this one has no styles because the path is jacked. http://localhost/testSite/index.php/register Does CI have something inherent to address this or should I write my own function. Thanks
[eluser]Aea[/eluser]
Add a / in front, or set your urls manually using base_url() if you won't be at a top-directory (sub domain, in a folder, etc).
[eluser]Chris Newton[/eluser]
the benefit of using base_url().'public/css/default.css' is that if you ever move the entire application (and css) to a subdirectory, the link will be corrected with one minor change, rather than replacing ever '/' throughout the site. Of course '/' IS mighty convenient.
|
Welcome Guest, Not a member yet? Register Sign In |