Script: Day by Day Vertical

April 20, 2004
3:20 pm
Posted in: Miscellaneous

All of you who have wanted to display Chris Muir’s Day by Day cartoon on your website, but couldn’t find a way to fit the horizontally oriented strip into your design, you now have Day by Day Vertical by yours truly.

Current Version: v.0.5

Description

A PHP script to display Day by Day in a vertical orientation, dynamically.

Requirements

  • PHP (tested on 4.3.4)
  • PHP parsed on pages where you want to display the strip

Features

  • Display the current day’s strip
  • Figures the most recent strip by date, but will not attempt to display the current day’s strip if no strip has yet been released (will display the previous day’s strip until the new one is availible)
  • Optionally allow the display of past strips, with a configurable number of archived days
  • Optionally displays the most recent strip’s first frame only, with the 2nd and 3rd frames availible with dropdown JavaScript
  • Option to have line breaks between the frames, or not
  • Use text arrows, or your own images for previous/next and expand/retract
  • Option to hide the current date text and the “previous strips” link (only if you are only displaying the most current strip)
  • Configure the “previous strips” text


Installation

  1. If you would like to use the simple black GIF arrows that I have included, place them in your images directory.
  2. Place the transparent.gif file in your images directory
  3. Open the daybyday_vertical.php file, and modify the settings. The following setting you NEED to set:
    • $images_path = ‘http://www.site.com/images/’;
      This is just the URL to your images directory.
  4. Upload the script to a location on your server.
  5. If you have decided to use the javascript option to display only the first frame of the most recent strip (with the other frames available in a JavaScript expander), you need to embed the following JavaScript into the HEAD section of all pages that the strip will be shown on.
    function showMore(varA1, varB1){
    var123 = ('varXYZ' + (varA1));
    varABC = ('varP' + (varA1));
    if( document.getElementById ) {
    if( document.getElementById(var123).style.display ) {
    if( varB1 != 0 ) {
    document.getElementById(var123).style.display = "block";
    document.getElementById(varABC).style.display = "none";
    } else { document.getElementById(var123).style.display = "none";
    document.getElementById(varABC).style.display = "block"; }
    } else { location.href = varB1;
    return true; }
    } else { location.href = varB1;
    return true; }
    }
    

    If this script looks familiar, it is because it is the commonly used “expandable entries” script. So if you use that script, you will not have to embed it again.

  6. Finally, you must now insert the PHP include call to the script:
    <a name="daybyday"></a>
    <?php include '/home/site/path/daybyday_vertical.php'; ?>
    • The include path is the server path to the script, not the URL
    • The anchor on top is used by the script to refocus the browser to strip when viewing past strips or when expanding/contracting the current day’s strip with JavaScript. If you have a sidebar title above the strip, you can put the anchor there.

Additional installation notes:

  • The width of the generated divs is 185px
  • The width of any sidebar they are placed in needs to be at least 187px
  • The width of the “previous” and “next” links may exceed 185px unless the strip inherits CSS styling that reduces the size of the text… small, x-small, or x-small should be fine.
  • If you have a background color assigned to a:hover{}, you need to add the following line to your CSS file so you don’t get funky results on mouseover:
    a:hover.daybydaylink { background-color: transparent; }

Download

daybyday_vertical_v0.5.zip

Versions

  • v0.5 Previous/Next links are set to target=”_self” to counteract any of you who have all links opening in a new browser window. Bug was fixed where if you turned archives off, it would display a link to the previous day (which wouldn’t work)
  • v0.4 Removed HTML comments, simplified installation so that only one variable has to be set for it to work (thanks to the King)
  • v0.3 Added CSS class to the links around the images so people who have a background color assigned to a:hover{} don’t get funky results. The links are class=”daybydaylink” You’ll want to set it like so in your CSS:
    a:hover.daybydaylink { background-color: transparent; }

  • v0.2 First release
  • v0.1 Unreleased alpha version

53 Responses to “Script: Day by Day Vertical”

  1. Rob says:

    Mark, the script works great. I just put it in on my site.

  2. jweaks says:

    I can get it to run, but not within a menu box (like on this site). It won’t render right. The code that renders the box is expecting HTML. Any ideas as to how to get the include to work?

  3. Mark says:

    The page from which you make the include must be PHP parsed (which usually means it needa a ‘php’ extention.) Also, you must ‘include’ the script by refering to its server path, which is NOT the same as its URL or its relative path. A server path looks like ‘/home/site/www/www/path/daybyday_vertical.php’ or something like that. Yours will be different!

  4. Cold Fury says:

    A real breakthrough
    Plenty of you have asked me about running the Day By Day strip vertically, thinking that there was some scripting magic involved in the way I did it. Alas, my poor brain is far too cluttered with snippets of songs I wrote ten years ago and promptly for…

  5. Bad Money says:

    Get Vertical
    At long last, Mark of Tempus Fugit has invented a PHP script for displaying Chris Muir’s Day By Day cartoon vertically.

    Which would be even cooler if I knew what the hell a PHP script was.

  6. [...] ms like familiar subject matter. Acronyms are fun Might this be a reference to the PHP script I wrote that displays Day by Day in the vertical orientation? Visit The King [...]

  7. Tempus Fugit for the PHP code on getting a vertical strip. Excellent work.

  8. Unfortunately, a lot of us who use Blogger and other platforms have been limited in our display options because they don’t support PHP parsing. Tempus Fugit provided a vertical option that could be displayed in blogs that support PHP parsing, but that still left some of us with only the

  9. basil's blog says:

    don’t know, you probably don’t use it) have had an additional method for carrying “Day By Day” for nearly two years now. Back in April 2004, Tempus Fugit offered a PHP script that could be added to PHP sites that allowed them to display “Day By Day” in a vertical format. That’s the first

  10. The Alliance says:

    don’t know, you probably don’t use it) have had an additional method for carrying “Day By Day” for nearly two years now. Back in April 2004, Tempus Fugit offered a PHP script that could be added to PHP sites that allowed them to display “Day By Day” in a vertical format. That’s the first

  11. AlphaPatriot says:

    Day by Day — Vertically
    As you can see I moved the excellent Day by Day cartoon to the right side column.

    I did this by using a script from Tempus Fugit. It was so easy…

  12. AlphaPatriot says:

    Nice job! I especially congratulate you on your instructions. It’s difficult to find things like this on the internet that a programmer has created AND that I can figure out how to implement.

    I’ve been working on a “random object” script for a week now!

  13. PShene says:

    I have carefully followed all of the instructions, but the strip still will not appear on my page. Any suggestions?

  14. Mark says:

    I’m not familiar with BlogSpot… can you actually run PHP?

  15. PShene says:

    Hmmm…good question. I don’t know for sure, but can poke around their FAQ search page, I guess. Is there a quick and easy way to test for sure?

  16. chris muir says:

    yes,mark, it IS a reference to that voodoo that you do, so well.

    scripts are all black magic to me…

  17. LaDonna says:

    I love this way of displaying Chris’ cartoon on my site. I was wondering if you had posted the code to display it as you currently are anywhere on your site. I couldn’t find anything by searching your site. If not, do you plan to? I love how the strip opens sideways. Thanks for posting this script, though.

  18. Mark says:

    I haven’t yet released the code that allows me to do this. But now that Day by Day is back, I’ll put it on my to-do list.

  19. AlphaPatriot says:

    I’ve noticed that the picture does not display in FireFox v 1.0. I’ve hit both your site and mine. Both sites display fine in the browser from the evil ones, however.

    I cannot for the life of me figure out why not. An image is an image is an image. Is it FireFox or did I screw something up when I rebuilt my laptop?

  20. AlphaPatriot says:

    Never mind. A journey through FireFox Options showed that I had turned off images for anything other than the originating site. My silly paranoia, no doubt.

  21. John Dunshee says:

    OK, I’m a dumbass. I can’t seem to get this to work. You say to insert the PHP include call in the script. Does that mean that it is inserted in the Main Index Template or into the php script on the server? If it goes into the server, what goes in my template to position it on by page?

  22. Mark says:

    John, you need PHP for this to work. Your pages are .htm so they are not parsed for PHP.

    The PHP include call could be put anywhere in your template, were it to generate files with a .php extension.

  23. Steve L says:

    I gave it a try but no luck so far. The Javascript inserted in the HEAD portion of my main_php just showed up as text. I had all sorts of errors where I expected the strip to appear. I would like to do it exactly the way you have it.

  24. marc says:

    I installed this script a few days ago and have encountered a couple of problems.

    One is due to the arrow images that I can solve when time permits.

    The other problem is related to time. I’m based in the Philippines. As a result I live, and the blog is set, 12 hours ahead of Americas EST.

    What results is having no comic (image is empty) displayed until noon local, or 12 midnight EST.

    Is there a setting within the plugin that can cure this? Obvoiusly my choice would be to have a comic displayed at all times even if it is 12hours time late local time. (ie local time is 8am on the 25th, and the comic displayed is from the 24th and would update at noon local, midnight EST)

    Thanks.

  25. Mark says:

    There is indeed a setting. You can set it to -12 to adjust for your time. Eventually I’m going to release a new version, with improved speed, and without the need for local time adjustments. I wrote this a year ago, and I’ve learned a lot since then. :-)

  26. marc says:

    Hmmm is it in the Calculations section? Specificly this part.

    $update_lag_offset = 1;

  27. marc says:

    Hmmmm… let’s try this again.

    Hmmm is it in the Calculations section? Specificly this part.

    $update_lag_offset = 1;

    Thanks

  28. Mark says:

    Hm, I must be going crazy, because I could have sworn that I put that option in there. It appears that it would take some serious hacking to change that in the current version of the plugin. I’m working on a new version of the plugin that will be massively improved, and will use GMT to do the time calculations, so it shouldn’t require an offset. Stay tuned.

  29. marc says:

    Thanks, no problem will be waiting for the update.

  30. Sid says:

    I could sure use some help. I can run my modified daybyday_vertical.php as a url directly and it looks fine but I cannot get the call script to display in my sidebar.php file. I am using Movable Type 3.15 and XHTML I believe (I am a noob).

    My URL path looks like this:
    http://www.truthoutloud.com/tolblog/scripts/daybyday_vertical.php

    My FTP path looks like this:
    /public_html/tolblog/scripts/daybyday_vertical.php

    What would my day by day call script path look like?

    My normal includes have (” instead of ‘ and “) instead of ‘ so no idea if that makes a difference. I have tried several variations with no luck.

    Any advice would be greatly appreciated.

  31. [...] Vertical Day by Day display script courtesy of Tempus Fugit [...]

  32. Aaron's cc: says:

    Within the last week or two, text has appeared over my DbD frames.

    See right column of my blog. Has something changed that I need to fix at my end?

  33. [...] Copy and Paste the code below in your website to have the current Day by Day cartoon displayed on your site: <!– add the following lines to your website to get the most current cartoon from http://www.daybydaycartoon.com –> <script language=”JavaScript” src=”http://www.daybydaycartoon.com/scripts/daybyday.js”></script> <a href=”http://www.daybydaycartoon.com”><img src=”http://www.daybydaycartoon.com/images/sp.gif” height=”200″ width=”575″ id=”dayByDay” name=”dayByDay” border=”0″> <script language=”javascript”>MM_changeProp(‘dayByDay’,”,’src’,parseUrl(),’IMG’);</script> <br><img src=”http://www.daybydaycartoon.com/images/sp.gif” border=”0″ height=”1″ width=”20″>Day By Day© by Chris Muir.</a><BR> <!– Code copyright 2004 by Day By Day©; any redistribution, resale, or reuse without permission of the owner is forbidden –> <!– end Day By Day©; code–> The code above will display a horizontal image, for a vertical script, download the code from Tempest Fugit. [...]

  34. Brian says:

    I don’t have a website but was thinking about having the cartoon on my emails as a signature block. It only lets me put the link in not the cartoon…. I use hotmail. any quick fixes…

  35. Mark says:

    Not a clue Brian… although I think Hotmail uses plain text for composing e-mail, and you simply cannot include an image in a plain text e-mail.

    And, as an announcement to everybody, I am in the final stages of working on a brand new version of this script that will allow many different modes of display, including the “horizontal expansion” method you can see on the front page of this site. Stay tuned!

  36. chris muir says:

    I LOVE that horizontal presentation, Mark!!! You da man!

  37. LaDonna says:

    I can hardly wait for the horizontal expansion script–you’re totally awesome for doing all of this, Mark!

  38. Could you give the addresses of a couple of sites that are using the php file to show the whole strip vertically? Then I could look at their source code and perhaps figure out what I may be doing wrong.

  39. Mark says:

    You won’t be able to use the PHP script on blogspot… they won’t process the PHP. But if you just want to look at the HTML it produces, Captain’s Quarters is using it. You could also take a look at the HTML generated by the new version I’m working on. Its testbed is here (shh, don’t tell!) I’ve set it up so you can see the different modes of display that it is going to offer.

  40. Sid says:

    I use the vertical version here. The real trick is knowing your server path. Other then that the installation instructions are dead on. Also realize there are some quirks associated with hover color values. The can be worked around but can be a pain.

  41. Your horizontal expansion of DayByDay is awesome. I would like to try the horizontal left. Two questions: 1. do I need to embed the “expandable entries script” below the head and above horizontal left code? 2. Will this code bring in each day’s cartoon automatically? Hope these aren’t stupid questions.

  42. Mark says:

    Russell,
    The code that brings in each day’s cartoon is PHP code, and simply will not run on Blogspot. PHP is code that is processed by the server before it is sent to the browser, and thus requires a server that will process it. Blogspot just serves plain HTML, so the PHP code will not be processed.

    The script you are using on your site uses JavaScript. This is client-side code, that is processed by the user’s browser. That is really your only option at Bloglines. It has several limitations as compared to the PHP code: namely that it doesn’t always update at the right time, and also will display a blank strip, if Chris is late getting one posted.

    With a little work, you could get it to feed the URIs into the HTML output of my script. That would at least give you the benefits of the compact display modes for a sidebar. The official script provided at the site is copyrighted, so I am prevented from modifying it and distributing it to you, but the function that it performs (figuring out the current date and printing an image) cannot be copyrighted, so as long as I do the work for it on my own, there’s no problem. I’ll tell you what… I’m probably going to release the new version of the PHP script within the next week. I’ll try to have a simplified JavaScript version as well. I’ll post an update here when I do so.

  43. aj urie says:

    I spent hours trying to figure out why I couldn’t get the script to work. First problem was I had no idea what the server path to the script was, I finely emailed my provider, and waited the three days it takes for them to get back to me, and then asked again when they answered the wrong question. The server path does not look even remotely like the URL. Then for some reason I completely missed the idea that I would have to rename my page, mylinks.html to mylinks.php. I thought only the daybyday_vertical.php had to be a php.

    If you go to my http://www.urie.us/mylinks.php and try to view the source, it won’t do you any good. The source you will see is after the php has rewritten the code, not the actual html.
    aj urie

  44. Bill Dennis says:

    First: I love the Day by Day and I thank you for creating this script. Second: It seems that the bottom of the last frame is cut off. Any ideas on how I can fix it?

  45. Bill Dennis says:

    You know what? Sign me up for a Gravatar!

  46. Aaron's cc: says:

    I’m getting a new error message. Can you take a peek at my right margin and point me in the right direction for a fix? Thanks.

  47. [...] Day By Day @ The End Of The Page Scroll down to the bottom of the page and you’ll find the latest addition to this site, Day by Day the hip, current events related cartoon penned by the biggest star being completely ignored by the Extreme Media, Chris Muir.It’s at the bottom of the page because this blogging software isn’t php-based, and because Muir hasn’t extended permission to tinker with the code. Besides, to squash it into the sidebar makes it unreadable anyway. Kind of like if it ran in the funny pages.Click on the DBD link above to find out the low-down on the four main characters.For anybody who’s looking for a self-portrait of yours truly, check out Zed and picture a substantial paunch on him. We could be twins. [...]

  48. Daily Pundit says:

    [...] On his “Install DBD” page where he provides the code for a horizontal display, Chris links to this script for a vertical display from Tempus Fugit. Posted by Scott Crawford on January 2, 2006 01:17 PM | Link to this comment | Tip Jar | TrackBack (0) New Year’s Resolutions [...]

  49. So where’s the script? I get a file not found.

Leave a Reply

Note: If you are replying to another commenter, click the "Reply to {NAME} →" button under their comment to help the conversation have a better flow!

Anti-Spam Quiz: