Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   PHP (http://www.programmingforums.org/forum29.html)
-   -   Php Automation (http://www.programmingforums.org/showthread.php?t=376)

thechristelegacy Aug 18th, 2004 3:49 PM

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 :D

big_k105 Aug 18th, 2004 4:00 PM

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 :)

Pizentios Aug 18th, 2004 4:59 PM

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.

Pizentios Aug 18th, 2004 5:00 PM

oh, and you'd also have to run this code inside your header where you want to declair your css

thechristelegacy Aug 18th, 2004 5:08 PM

Thanks, I'll definatly start with that. I'll post the final content then.

Pizentios Aug 19th, 2004 8:58 AM

your welcome. post a link to the site too!

thechristelegacy Aug 19th, 2004 11:40 AM

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 :D

Pizentios Aug 19th, 2004 11:44 AM

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.

thechristelegacy Aug 19th, 2004 11:57 AM

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.

kurifu Aug 19th, 2004 1:07 PM

IFrames are the devil!


All times are GMT -5. The time now is 12:58 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC