Forum Moderators: not2easy

Message Too Old, No Replies

Embedded CSS with PHP

         

Sarah Atkinson

4:32 pm on Sep 15, 2005 (gmt 0)

10+ Year Member



I'm using php include a style called #header I'm doing this because #header has some php code in it. first I tried just puting it in my .css file but the server won't parse the php in a .css file. changing it to a php file even with the data type header thing at top didn't work either--something to do with the setings on the server. So with the top 2 ways shot down by my Host I'm trying to find a work around

I created a file just for my #header style. Then I tried to include it into my embedded css in the index.php file. as soon as it hit the <?php it just stoped and all I got was a few styles spit out for the page.

so then I added the <style> tags to the include file and included it after the </style> tag.

Can you have two sets of <style> tags in one document?
This way didn't work either?

Does anyone else have any ideas?

jetboy

11:05 pm on Sep 15, 2005 (gmt 0)

10+ Year Member



Sarah, check out:

[webmasterworld.com ]

Particularly the first post from jetboy_70 (hmmm, wonder what happened to him? ahem). Basically, put the style in your regular CSS file and enable PHP parsing as detailed in that post.

Sarah Atkinson

2:49 pm on Sep 16, 2005 (gmt 0)

10+ Year Member



I've already read though it twice. I can not enable the server to parse the css file for php. My host was very distinct on that point for their "Shared Servers".

I finaly got it to work though. I put it in another file and imported that file into the header. Although come to think of it the same problem that wasn't letting it work before might have been preventing me from having the .css file a .php file with that line at the top.

apperently why the import wasn't working is that I .. umm.. didn't debug my code. Well..I never make code mistakes right? I forgot to escape my strings.

jetboy

3:05 pm on Sep 16, 2005 (gmt 0)

10+ Year Member



Heh heh. Glad you got things working.