My Annual Advent Service

First off have a blessed Advent!

Eight years ago I decided to create my own Advent Wreath graphic instead of just using the normal animated gif that I had used previously. If you would like it for your own blog you can use the html code below. I will replace the graphic each week so that it correctly shows the number of candles that should be lit. On Christmas I will change it to another graphic I created for Christmastide.

<img src=”http://www.splendoroftruth.com/curtjester/wp-content/uploads/Advent/curtjester_advent.gif” width=”170″ height=”189″ />

Additionally underneath my Advent graphic on my left side I have code that does a Christmas countdown showing how many praying days left.

Below are both a JavaScript and PHP versions.  For WordPress use the PHP version.

JavaScript Version

<!– Christmas Countdown – Jeff Miller–>
<script language=”JavaScript”>
function eventcount() {
var now = new Date();
var message = “”;
var event = new Date(“Dec 25 2013 00:00:01″);
var seconds = (event – now) / 1000;
var minutes = seconds / 60;
var hours = minutes / 60;
var days = hours / 24;
if ( (days%1)<.5)
days++;
days = Math.round(days);
if (hours< 0 && hours >= -24)
message = “Merry Christmas; Christ is born!”;
else if (days > 0)
message = “Only “+days+” praying day”+ (days>1?’s’:”)+ ” till Christmas!”;
document.write(“
<p>”+message+”</p>
<p>”);
}
eventcount();
</script>
<!– End Christmas Countdown –>

PHP Versions

<?php function countdown( $event, $month, $day, $year )
{
 // subtract desired date from current date and give an answer in terms of days
 $remain = ceil( ( mktime( 0,0,0,$month,$day,$year ) - time() ) / 86400 );
 // show the number of days left
 if( $remain > 0 )
 {
 print "<p><strong>$remain</strong> more praying days until $event</p>";
 }
 // if the event has arrived, say so!
 else
 {
 print "<p>$Merry Christmas; Christ is born!</p>";
 }
}
// call the function
countdown( "Christmas", 12, 25, 2013 );
?>

Note: PHP version is adapted from here.

(127)

Jeffrey Miller (517 Posts)


You can leave a response, or trackback from your own site.

Leave a Reply

Hide me
Sign up below to have the hottest Catholic news delivered to your email daily!
Enter your email address:
Show me