Welcome to WebmasterWorld Guest from 126.96.36.199
Forum Moderators: not2easy
I have a minor issue.
I am using relative locations (ie. ../)for my images found within my CSS file.
This has been working great as long as I keep everything I do in the root directory. I started utilizing different directories to keep my code in and found out that the further I go away from the root directory the more issues I am starting to have utilizing the above method. (This goes the same for my JS file directory)
Reference the chart below The problem that is happening is when the public directory attempts to access the css file it looks for the css file as support/css/css.css rather than root/css/css.css
I utilize multiple include files and have massive amounts of code to make everything on the website work together so I cannot re-write everything and start over again.
Without rewriting everything and moving everything into different directories, I would like to be able to utilize the same php include files and the same CSS, JS, Image files, etc so that when I make a change to the website I only have to do so in 1 file to make it site wide.
Root Directory has the following directories:
(You will notice that in the Root there is are CSS, JS, Images and Support Directories. You will also notice there is a Public Directory located within the Support directory. This is where the issues is at.)
CSS --> All Images Referenced as ../Images/
Support --> Public --> References A CSS.PHP file as ../../css.php
A portion of the contents of the CSS.PHP are:
<link rel="stylesheet" type="text/css" href="../css/css.css" />
I thought about utilizing absolute references but by personal preference would like to stick to relative references.
What do you think?
The / means start at the domain root. So you can move a file containing this
**anywhere** on your site and it will always locate file.html.
The same is true in your scripts,
$css = '/css/scripts/scripts.css';
and your css
The down side: requires a web server; working on these files locally on either PC or Mac will not find the locations. You can temporarily revert to relative using a S & R function in your editor.
(I have actually been a member of webmasterworld for quite some time but my original username and password were not working and the password recovery page was non existent. I had to create a new username.)