![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Expert Programmer
|
Alright, I'm in charge of designing my church's website. And each of the religious seasons has a specific color. For each season I have an appropriate CSS file (Blue.css, Green.css etc). Anyway, how could I implement this with PHP. I'm assuming I'd need a to use the date module, but how would I tell it to use which CSS script according to the date? Any help is appreciated. Thanks
![]() |
|
|
|
|
|
#2 |
|
PFO Founder
![]() ![]() |
well with psuedo code. what you would do is
Check Date; if data is > then say Dec 1st then print xmass.css and soo on ![]() if someone hasnt helped out better thent hat by the time i get home i will look up exactly how to do this ![]()
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. |
|
|
|
|
|
#3 |
|
Programming Guru
![]() ![]() |
Here goes nothing:
<?PHP
function compair($date1, $date2, $date3)
{
//all dates must be unix timestamps.
//date1 is the current date.
//date2 is the starting date of a period
//date3 is the ending date of a period.
if ($date1 >= $date2 && $date1 <= $date3)
{
return true;
}
else
{
return false;
}
}
$mydate = date("m.d.y");
list($month, $day, $year) = split('.', $mydate);
$dt = gmmktime(0,0,0,$month, $day, $year); //this is today's date in a unix timestamp.
$periods = gmmktime(0,0,0,12,1,$year); //give you dec first in a timestamp.
$periodf = gmmktime(0,0,0,12,31,$year); //give you dec 31 in a timestamp.
$periods1 = gmmktime(0,0,0,1,1,$year); //give you jan first in a timestamp.
$periodf1 = gmmktime(0,0,0,1,31,$year); //give you jan 31 in timestamp.
//you'd have more of these...how ever many periods that you wanted.
if (compair($dt, $periods, $periodf))
{
//output some html to include your css here.
}
elseif (compair($dt, $periods1, $periodf1))
{
//output some html to include your css here.
}
?>ofcourse none of this code is tested and is just ment to get you going in the right direction, so i don't know if there are errors in it or what. good luck.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#4 |
|
Programming Guru
![]() ![]() |
oh, and you'd also have to run this code inside your header where you want to declair your css
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#5 |
|
Expert Programmer
|
Thanks, I'll definatly start with that. I'll post the final content then.
|
|
|
|
|
|
#6 |
|
Programming Guru
![]() ![]() |
your welcome. post a link to the site too!
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#7 |
|
Expert Programmer
|
The site is http://www.lavansv-bakersv.org It's not completed yet, so half of the main links don't go anywhere yet, and there are a few places that arent't updated yet. Don't complain about the sloppy coding :-D (using frames for a layout, the pastor wanted it). I didn't write the other CSS scripts yet. I'll get those going in about a week here, I'll post back when I have everything up to par. Feedback and suggestions are welcomed
![]() |
|
|
|
|
|
#8 |
|
Programming Guru
![]() ![]() |
Looks good, however i feel sorry for you because you have to use frames. why not use tables and some nifty iframes? It could use a little more color and some nice gradients to make the menu and rest of the page pop out at the user. I know it's just in the begining faze, so i am sure that it'll just keep getting better and better looking.
Good work so far though.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#9 |
|
Expert Programmer
|
Yeah, I need to run alternate layout ideas past my pastor. Iframes are nice, but I've seen some odd things happen with them accross some alternate browsers. But then again, most the people in this small town of Pennsylvania have never heard of Mozilla and use either IE or AOL. I'll definatly consider your ideas though.
|
|
|
|
|
|
#10 |
|
Expert Programmer
|
IFrames are the devil!
__________________
Clifford Matthew Roche <geek@cliffordroche.com> Web Hosting: http://www.crd-hosting.com Consulting: http://www.crdev-consulting.com |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|