0

I found an example here https://code.google.com/p/fastcssloader/ for loading several stylesheets using only 1 link rel=...

Everything worked fine until I tried to use the code linked above.

My link code:

<link rel="stylesheet" type="text/css" href="/styles/css_include.php" />

I literally copied the code and put the above .php in the directory where my styleshees are but no matter which style I choose from the options page I created (which stores a cookie telling which stylesheet to load on all pages) it always loads the second one in that directory. Any idea what is happening?

EDIT: This was using Chrome. Apparently the second stylesheet is cached somewhere (even though I must have pressed ctrl f5 a dozen times) because when I open the page in IE8 (dont ask) the stylesheet is not loaded at all. What am I doing wrong? Why doesn't the code load the stylesheets even though I copied it exactly? Is it the directory? I tried making the directory "." and "/styles" and a combination of them all.

EDIT: I moved the css_include.php file into the directory where my pages are stored and referenced it accordingly and now it doesn't load any stylesheet at all, so at least keeping css_include.php in the /styles directory loaded SOMETHING. I am at a loss here...

user3715740
  • 27
  • 1
  • 6
  • possible duplicate of [calling multiple external css files at once to html page](http://stackoverflow.com/questions/17432929/calling-multiple-external-css-files-at-once-to-html-page) – JayKandari Jul 16 '14 at 12:49
  • 1
    I would in general recommend against the practice of adopting random code samples of questionable quality and no discernible reputation. That code in particular applies a compression "algorithm" that I doubt is really safe. Look into LESS or SASS if you want to compress your CSS. – Pointy Jul 16 '14 at 12:50
  • I don't want to compress my css, I just want to load multiple stylesheets. This was the closest thing I could find because on the code.google.com page it says: Instad of: lines> You write: This is what I want to do. I don't care if it's compressed or not right now, I just have 5 pages and dont want to have to add a line to each every time I want to add a new style. I want to be able just add a stylesheet to the directory and change the options page so it will be easier to update. – user3715740 Jul 16 '14 at 12:56
  • -> Jai, I saw that already and am not sure hot to implement @import. I have 5 pages and before I had 7 tags to load each individual style. Every time I want to add/change a theme I would have to edit each file individually, so I thought it would be easier and smarter to have a directory of css files that I can call all at once on each page so all I have to do is add a new style to the /styles directory for better updating purposes. – user3715740 Jul 16 '14 at 12:59
  • Update: I tried the @import method and it "works" but it only displays the final css in the list. It ignores the cookie information I have stored from the options page...what could be done about that? – user3715740 Jul 16 '14 at 15:09

0 Answers0