|
|
#1 (permalink) |
|
Registered User
On a golden path...
Joined in May 2004
332 posts
Gave thanks: 0
Thanked 0 times
|
Style Switching
I don't know if this is possible but here Is what id like to accomplish. I have googled it and been unsuccessful.
I have php includes, and I want to have it change to a red layout when it changes to something chiefs related (some table cells bg color from blue to red). How do I accomplish this, if possible?
__________________
www.anything4free.com (Not my site but if you want free stuff (ipods, flatscreens etc) go there.) |
|
|
|
|
|
#2 (permalink) |
|
Hostering?
Excelling Contributor
Joined in Jan 2004
Lives in New York
Hosted on D41
970 posts
Gave thanks: 0
Thanked 0 times
|
You could use alternative style sheets and have a javascript switch them. I've seen it done.
__________________
*-[www.oolio.com]-* {_DIME.41 Reseller_} Stay cool. ![]() >> Avatar used with permission from garyzullo.com <<
|
|
|
|
|
|
#3 (permalink) |
|
Surpass Fan
Seasoned Poster
Joined in Aug 2004
Lives in North Carolina, USA
Hosted on Pass11
46 posts
Gave thanks: 0
Thanked 0 times
|
I'd prefer to do it in PHP.
I checked out your site's HTML source. First, I'd advise using external stylesheets (CSS in a seperate file) and link it to the page by putting this in your HTML HEAD section: Code:
<link rel="stylesheet" href="/path/to/stylename.css" type="text/css"> PHP Code:
Hope that helps! The Javascript thing mobius mentioned would probably also work, but I know PHP, not Javascript. ![]()
__________________
All your base are belong to us. Last edited by AngryPeasant; August 12th, 2004 at 2:31 AM.. Reason: typo in code snippet |
|
|
|
|
|
#4 (permalink) |
|
minor deity
Super #1
Joined in Apr 2004
Lives in Georgia
Hosted on XEON
7,395 posts
Gave thanks: 28
Thanked 94 times
|
Right!
My 'index' page is just a bunch of includes. It would not be too difficult to include a different 'head.inc' within the conditionals.... PHP Code:
You could easily modify that to build a $head variable based on the requested page too... if you follow. You just then have to move the 'require head.inc' down into the conditional loop. John
__________________
Proud to be a Surmunity Mod! XEON Make a fundamental difference! My Sites: Curious about Brewing Beer? Join the community! >>>>> Some Change is GOOD! Keep your paycheck! Support the Fair Tax Get into an Art museum Victorian London It's your brain -ON WEB - mybrainhost.com (under development) What SHOULD Government do? Much Less than it Does! |
|
|
|
|
|
#5 (permalink) |
|
Registered User
On a golden path...
Joined in May 2004
332 posts
Gave thanks: 0
Thanked 0 times
|
Okay, i see what your doing. I got the location.
What should i put in the table cells and style sheet so they change when i want them to. For example, the default is certain cells are blue. When chiefs is selected I want them to turn red using this css. How do i do that? Just curious what do you mean out of order? And i also assume that if I want to add another option to change the style sheet, I could by adding an else if?
__________________
www.anything4free.com (Not my site but if you want free stuff (ipods, flatscreens etc) go there.) |
|
|
|
|
|
#6 (permalink) |
|
Registered User
On a golden path...
Joined in May 2004
332 posts
Gave thanks: 0
Thanked 0 times
|
I just can't get it to work (the style sheets themselves)
__________________
www.anything4free.com (Not my site but if you want free stuff (ipods, flatscreens etc) go there.) |
|
|
|
|
|
#7 (permalink) |
|
minor deity
Super #1
Joined in Apr 2004
Lives in Georgia
Hosted on XEON
7,395 posts
Gave thanks: 28
Thanked 94 times
|
Post a link to your style sheet and a snip of the html that you want styled.
__________________
Proud to be a Surmunity Mod! XEON Make a fundamental difference! My Sites: Curious about Brewing Beer? Join the community! >>>>> Some Change is GOOD! Keep your paycheck! Support the Fair Tax Get into an Art museum Victorian London It's your brain -ON WEB - mybrainhost.com (under development) What SHOULD Government do? Much Less than it Does! |
|
|
|
|
|
#8 (permalink) | |||
|
Registered User
On a golden path...
Joined in May 2004
332 posts
Gave thanks: 0
Thanked 0 times
|
Quote:
Should be this: Quote:
Quote:
__________________
www.anything4free.com (Not my site but if you want free stuff (ipods, flatscreens etc) go there.) |
|||
|
|
|
|
|
#9 (permalink) | |||
|
Surpass Fan
Seasoned Poster
Joined in Aug 2004
Lives in North Carolina, USA
Hosted on Pass11
46 posts
Gave thanks: 0
Thanked 0 times
|
Quote:
Then in your stylesheet files make another style rule for ".tableborder" like this: .tableborder { background-color:#000099; } Then, depending on which stylesheet is used for the page, ".tableborder" could mean blue, red, or whatever other color is present in the stylesheet. Quote:
<html> <head> <!-- meta tags, stylesheets, title, etc --> </head> <body> <!-- all page content --> </body> </html> It's wierd that what you have works, because there's multiple head, body, and html tags. But since it does actually work, it's a secondary issue. If you have the time it'd probably be a good idea to clean it up a little. (so that when people like me invade your source, we can't complain) ![]() Quote:
__________________
All your base are belong to us. |
|||
|
|
|