You are viewing a plain-jane printable version of http://CoverYourASP.com/PrinterFriendly.asp.See how this was done
|Since I added the "Printer-friendly page" option on the left of the page I've noticed quite a few failed searches for a description of how it works. So here it is!|
It's very simple. The link on the left of the page is made up from the following code in utils/Header.asp, designed to call the current page with "plain" added to the URL.
Since the URL of the page may already have some parameters in the QueryString (the part following a ? in the URL), I either have to add ?plain or &plain.;
The "plain" in the URL is detected in utils/Init.asp, and the bPlainJane variable set when it is found:
Note that although I use the b prefix to imply the variable is a boolean, it really is the number of "plain" parameters in the URL. I just use it as a boolean expression.
Then it's a simple matter of testing bPlainJane where there is content that you want to add or remove for the plain version of the page. As an example, a new header is shown at the top of the printer-friendly page with this code in utils/Header.asp:
In fact this code not only displays a new header, but it also uses a narrower fixed-width table to contain the page, and stops the left navigation bar displaying. In a similar manner the right side of the page is removed.