Getting the paths correct |
[eluser]baalwww[/eluser]
Newbie question. I have my main directory, and the system directory beneath that. I'm able to find my images using the html helper and img() instead of <img>. Nothing else seemed to work. The problems I'm still having are: 1. Cannot find the css file. I have it in the root (same place where the images folder is), but it's not found. I don't think a leading slash will help, because the base is actually two subdirectories in from the domain name (mydomain.com/allprojects/thisproject 2. What do I do about referring to images, etc. in javascript in my view? Use the img() calls there too? 3. How about the urls for background images in the css file?
[eluser]mattthehoople[/eluser]
I'm probably wrong, (so I shouldn't really guess) but it might be something to do with index.php being inserted into your path. What do you see in the source of the resultant page?
[eluser]JoostV[/eluser]
Rewritten urls tend to confuse browsers. A url like www.domain.com/foo/bar tricks the browser into thinking it is in directory foo/bar/. This means you cannot use relative urls as you would on a static site. I always use absolute paths: Code: <link rel='stylesheet' type='text/css' media='all' href='<?php echo $this->config-base_url; ?>style.css' /> Alternatively, you can set a base href in your <head> section: Code: <base href="<?php echo $this->config-base_url; ?>" /> Url in css files are always relative to the the css file itself.
[eluser]baalwww[/eluser]
Yes, it was the relative URLs. What I did in the Javascript, the link and the img() calls was to provide the filename preceded by base_url() and they all work now, and once the css file was working, the relative links inside it for the urls worked as well. Thanks :-) |
Welcome Guest, Not a member yet? Register Sign In |