I have a style-sheet that is saved in this location:
/opt/lampp/htdocs/project/core/styles/Style.css
Now, what I need to do is load it using that full directory, because the files that are going to be using it are located here:
/opt/lampp/htdocs/project/client/
My goal is to create a completely dynamic site that updates correctly to numerous "Clients" based on their own personal information. So far I've got everything done, however I wanted to move the CSS to be loaded dynamically as-well so if I wanted to make any changes to the style-sheet they would be instantly noticed.. Here's where I'm running into a problem, I can't figure it out. I've followed the front page of google to a dozen of different methods using JavaScript, but none of them have worked and they are all from 2009-2010.. Perhaps someone would like to shed some light on my dark path?
this works for me:
document.write('<link rel="stylesheet" type="text/css" href="/opt/lampp/htdocs/project/core/styles/Style.css" media="screen" />');
I don't see any reason to use javascript unless a loaded page needs to refresh automatically when the style-sheet is changed.
If you just need it to reload automatically on the next page-load, you can use something like:
<link rel="stylesheet" type="text/css" href="/project/core/styles/Style.css?v=<?php echo time(); ?>">
Using an absolute path makes sure it will work for any client / file in any folder.
I have added the timestamp to the css file so that it will not be cached but you can also set up the server to disable caching for specific files.