CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 29th, 2004, 01:27 PM
jarow jarow is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 83 jarow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
writing a php statement to change a css style

I have a header.inc file and a footer.inc file that is called to each new file that I create.

The header.inc file holds all the javascripts as well as calls the css, etc. It also begins the body and the footer.inc file closes the body. In other words in each new file that I create I have a php statement calling the header, and at the bottom of the file another statement that calls the footer. So each new file is really only part of the body as the title and head are found in the header.inc file.

What I would like to do is be able to change the background color of the body of a new file if I choose to do so. But obviously because each new file is only part of the body I cannot put a css style in the new file.

Is there any way of writing a php statement that I can place in a new file that would allow me to change the background-color of let's say #faunabody for that particular page??.

Hope this is clear...thanks alot

Reply With Quote
  #2  
Old March 29th, 2004, 01:45 PM
Clan admin's Avatar
Clan admin Clan admin is offline
AZbb founder
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2004
Location: London, UK
Posts: 843 Clan admin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 52 m 44 sec
Reputation Power: 5
You can use different CSS for each variety i.e. if (this) then { that.css } etc. It can be done with JavaScript or PHP

You can also output simple style tags for that one that you want. They would override the previous ones if they appear AFTER the call to the CSS and before </head>

Example:

Code:
<!-- javascript stuff here -->
<style type="text/css">
<!--
#faunabody { background: #ffffff; }
-->
</style>
</head>
<body>


This is more a HTML/CSS question that PHP. You only use PHP to output the HTML.

Good luck
__________________
© AZ

AZbb :: AZ Bulletin Board - Secure BBS script, Front page CMS, Chat, No database
Simple Guide to Apache and PHP installation on Windows

Reply With Quote
  #3  
Old March 29th, 2004, 02:49 PM
grungefade's Avatar
grungefade grungefade is offline
I'm just an IF statement
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 400 grungefade User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 2 h 26 m 33 sec
Reputation Power: 5
why would you want to go through all that trouble just to do that. just simple put <body bgcolor="#000000">
__________________
"In a way, we're dead already"

Reply With Quote
  #4  
Old April 11th, 2004, 11:42 AM
nlmark nlmark is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 36 nlmark User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 23 sec
Reputation Power: 5
Maybe you could use

page:
PHP Code:
<?php
$background 
"#FFFFFF";
include 
"header.inc";
?>
page content
<?php
include "footer.inc";
?>


header.inc:
PHP Code:
...
<
style>
#faunabody {
background-color: <?php echo $background?>
}
</style>
... 

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > writing a php statement to change a css style


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT