Help with Penny-Arcade Active Desktop

A

Alvy

Guest
Could anyone help me with an active desktop that will automatically update itself daily with the latest comic strip from
http://www.penny-arcade.com/view.php3 ? I do not want to have the whole page on my desktop so simply putting the link is out of the question.
Thanks a lot =)
 
You'll need PHP to use this :
Code:
<html><head></head><body>
<script language="JavaScript" type="text/javascript">
function noImage(theImage)
{ theImage.src = "no.comic.today.png"; }
</script>
<?php
$today = date(D);
$pa = date(Ymd);
if ($today == Tue) { $show = true; }
elseif ($today == Wed) { $show = true; }
elseif ($today == Fri) { $show = true; }
else { $show = false; }
if ( $show == true ) { print "<img src=\"http://penny-arcade.com/$pa"; print "l.gif\" border=\"0\" onError=\"noImage(this);\">"; }
else { print "<img src=\"no.comic.today.png\" border=\"0\">"; }
?>
</body></html>
That's rather rough code though, I'm sure someone else will be able to do a better job, it may also be possible in just javascript.

You could just visit the site everyday, I know I do ;)
 
Is it possible to show the previous day's comic if there ain't one available for the current day? =)

Thanks Speedy, great job =) never knew someone would help me with such a big task.

If possible, msg me on EFNet =)
I'm Alv and idling in #NTFS too hehe

--
Oh yea, when I have it running, it keeps making the CPU do something (the LED blinks constantly until this active desktop is disabled), could you please fix that? I can't really use it now because of this =) Probably its because its checking for updates? Maybe you have to make this only at the beginning of a day?
 
ohhh

i'm definatly going to have to take a good look at this. that's for pounding that out speedy (btw: i go there everyday too =] )
 
X-Istence helped me optmise the code a bit, so now we have this ..
Code:
<?php
$today = date(D);
$pa = date(Ymd);
switch ($today) {
  case Mon:
      print "<img src=\"http://penny-arcade.com/images/2003/$pa"; print "l.gif\" border=\"0\" onError=\"noImage(this);\">";
      break;
  case Wed:
      print "<img src=\"http://penny-arcade.com/images/2003/$pa"; print "l.gif\" border=\"0\" onError=\"noImage(this);\">";
      break;
  case Fri:
      print "<img src=\"http://penny-arcade.com/images/2003/$pa"; print "l.gif\" border=\"0\" onError=\"noImage(this);\">";
      break;
  default:
     $date = date(d);
     $date--;
     $date2 = date(Ym);
     $pa = $date2 ."" . $date;
     print "<img src=\"http://penny-arcade.com/images/2003/$pa"; print "l.gif\" border=\"0\" onError=\"noImage(this);\">";
}
?>
Problems at present include end of month and viewing the page on a sunday, it'll be worked on tho :)

I also found a Javascript version created by someone else.
Code:
<html>
<head>
<script language="JavaScript1.2">

  function reset_image(name, pad) {

     today = new Date();
     if (pad > 0) {
        today = new Date(today.getTime() - pad);
     }

     year = today.getYear();
     if (year > 2009) {
        year -= 2000;
        year = new String(year);
     }
     else if (year > 2000) {
        year -= 2000;
        year = '0' + new String(year);
     }
     else if (year > 9) {
        year = '0' + new String(year);
     }
     else {
        year = new String(year);
     }

     if (today.getMonth() > 8) {
        month = new String(today.getMonth() + 1);
     }
     else {
        month = '0' + new String(today.getMonth() + 1);
     }

     if (today.getDate() > 9) {
        day = new String(today.getDate());
     }
     else {
        day = '0' + new String(today.getDate());
     }

     setTimeout("reset_image('" + name + "', 0)", 3600000);
     if (name == 'penny') {
        url = 'http://www.penny-arcade.com/images/20' + year + '/20' + year + month + day + 'l.gif';
     }
     eval('document.' + name + '_invisible.src = url');
  }

</script>
</head>

<body bgcolor="34629E" onLoad="reset_image('penny', 86400000);">
<img name="penny_invisible" src="" onLoad="document.penny_visible.src=this.src" width="0" height="0" style="visibility: hidden">
<img name="penny_visible" src="http://www.penny-arcade.com/images/2002/20020807l.gif" border="0">
</body></html>
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back