How to create a ‘Printer friendly’ page for Easyphpcalendar

I’m a dev with a L-plate round my neck so I thought I would post this up for any other learners like myself. I use Easyphpcalendar and wanted to create a calendar page that users could print off – without all the links etc on it.
  1. Create you printer friendly page .e.g. calendaronly.php and copy the following into it (you might want to change the CSS style to match your site ..<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
    <html xmlns=”http://www.w3.org/1999/xhtml”>
    <head>
    <link rel=”stylesheet” href=”print.css”
    type=”text/css” media=”print” />
    <meta http-equiv=”content-type” content=”text/html; charset=utf-8″ />
    <title>Printer friendly Calendar page by Adi Graham</title>
    <meta name=”keywords” content=”” />
    <meta name=”description” content=”” />
    <link href=”print.css” rel=”stylesheet” type=”text/css” />
    <style type=”text/css”>
    <!–
    .style1 {color: #FF0000}
    –>
    </style>
    <?php $CSS=1; require(“calendar/calendar.php”); ?>
    </head>
    <body>
    <div class=”title”>
    <h2 align=”center”>Adi Graham’s events calendar<br />
    </h2></div>
    <div class=”calendar”>
    <div align=”center”>
    <?php $OL=1; require(“calendar/calendar.php”); ?>
    <?php $TOC=1; require (“calendar/calendar.php”); ?></div>
    <div class=”button”>
    <div align=”center”>
    <p>
    <input type=”button” value=” Print this page ”
    onclick=”window.print();return false;” />
    </p>
    </div>
    </body>
    </html>
  2. Create a file called print.css and copy the following code into it.@charset “utf-8”;
    /* CSS Document */
    .button
    {
    display:none;
    }
  3. If you want to add more buttons / links to be hidden when printed etc then add additional div items in like the current ones (ignore the file: name) .e.g.file: calendaronly.php<div class=”label this as you wish”>

    file: print.css

    .label this as you wish
    {
    display:none;
    }

  4. That’s it’s .. save them off, load the celendaronly.php in a web browser. click the print button and see if all the stuff is hidden as you requested!

Leave a Comment

Your email address will not be published.

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers: