Welcome Guest, Not a member yet? Register   Sign In
Getting the paths correct
#1

[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?
#2

[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?
#3

[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:
&lt;link rel='stylesheet' type='text/css' media='all' href='&lt;?php echo $this-&gt;config-base_url; ?&gt;style.css' />

Alternatively, you can set a base href in your &lt;head&gt; section:
Code:
&lt;base href="&lt;?php echo $this-&gt;config-base_url; ?&gt;" />

Url in css files are always relative to the the css file itself.
#4

[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 :-)




Theme © iAndrew 2016 - Forum software by © MyBB