I forgot to update the actual display page for the print function. Thanks for the reminder Trip.
CSS
I choose to use 2 CSS for the print page, one for the screen (sans-serif for better screen legibility) and one for print (serif for better legibility on paper). Use the following in the header to achieve this effect:
Code: Select all
<LINK rel="stylesheet" type"text/css" href="screen.css" media="screen">
<LINK rel="stylesheet" type"text/css" href="print.css" media="print">
Table width
I choose to use a table width of 100%. If you use a fixed width table and it's greater than the margins of the printout, you'll cut off words, which is something I want to avoid. I used a javascript to force the pop-up, so it looks more presentable, and doesn't block the parent window in browsers like Mozilla and Safari.
Thanks again Trip for the print code, it was a big help.
**UPDATE**
I ran into an error with the javascript code and the $HTTP_REFERER used in the phprint.php code. The code works fine in Mozilla, but causes errors in IE, so it's back to launching a "_blank" window for now.
**FIXED**
I came up with an external php script that seems to do the trick. So far, I've tested in IE, NN and Mozilla on the PC platform, and Safari on the Mac platform.
Code: Select all
$current_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
echo "<a href=\"javascript:display('phprint.php?set_referer=".$current_url."','test',0,1,0,410,450)\">";
echo "<img src=\"img/article/print_icon.gif\" border=\"0\" alt=\"Print this Page\"></a>";
In the phprint.php code (around line 46 or so) from Trip, change the following:
Code: Select all
$read = fopen($HTTP_REFERER, "rb");
to
Code: Select all
$read = fopen($set_referer, "rb");