PHPBuilder - Creating a Printer Version Grab Method Page 9



RSS Twitter
Articles Html

Creating a Printer Version Grab Method - Page 9

by: Jim Fletcher
|
April 1, 2004

Adding Printer Version button via HTML
This method involves hard-coding the link to the printer version. You can hard code ALL of the data this way:
<a href=”http://www.yourdomain.com/print/print.php?company=yourdomain.com 
&url=http://www.yourdomain.com/pagebeinggrabbed.html&title=Title+Of+Page+Being+Grabbed”>
<img src=”http://www.yourdomain.com/print/printerversionbutton.jpg” border=0></a>
Alternatively, you can let the print.php script determine the URL of the page to be grabbed using $HTTP_REFERER. In this case, your may use the same link throughout your website.
<a href=”http://www.yourdomain.com/print/print.php?company=yourdomain.com”>
<img src=”http://www.yourdomain.com/print/button.jpg” border=0></a>
Adding Printer Version button via Javascript
This method is an alternative to the HTML method, and allows you to control the HTML for the Printer Version button and link in a central javascript file.
1. Add the following javascript to your webpage template in the place that you want the Printer Version button to appear:
<script language="javascript" 
src="http://www.yourdomain.com/print/print.js">
</script>
<script language=javascript>showbutton 
("yourdomain.com","main");</script>
The script allows you to specify a particular "Printer Version" button. The default button is "printmain.gif" but you can override this for a particular webpage by changing the word "main" to some other word. (e.g. if you want to use "printblack.gif" button instead, change the word "main" to "black")
2. Create a file called print.js.
The showbutton() function creates the HTML to show the printer version button and link to the printer version.
The showprinterversion() function opens a new window to show the printer version. You can customize the size and features of the window here. This function automatically URL encodes the URL of the page to be grabbed, and uses javascript to complete the title of the page.

« Previous Page
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Jim Fletcher

Comment:



Comment:

(Maximum characters: 1200). You have characters left.