Show printer friendly version of this page

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
noguru
Forum Commoner
Posts: 61
Joined: Thu Jun 06, 2002 4:03 am
Location: Just north of the City Of Gold, Land of Milk and Honey

Show printer friendly version of this page

Post by noguru »

Hi

Can anyone please tell me how to use CGI or anything else to view a printer-friendly version of your web page? I've seen this on some discussion forums (especially on ww.vbworld.com), where a parameter is sent to a cgi script on the load of a page and another parameter is sent to the same cgi script on the click of a <a>Printer friendly</a> link. I've got hundreds of pages which the user might want to print, but I don't want to have a copy of everyone just formatted for printing.

Any help will be appreciated.

Thanks
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Printer friendly generally means the removal of navigation and changes to the header and footer, it also commonly means that where an article spans several pages that they are all included onto one.

To create printer friendly pages easily there are a few approaches that you can take. You could use CSS and have two stylesheets one for display and another for printing (evolt.org article: Kissing Print Versions of Pages Goodbye). This is a great method for printing because there is no need to have a 'printer-friendly version' link, however, it won't work for older browsers.

Another method that works well when you are using PHP to include() your content into a page layout, is to have a separate page layout specifically for printing where you include() the content into a page which is more printer-friendly than your original setup.

Basically, how you do it depends on how your page is setup, what browsers you are targetting and what exactly you need from a printer-friendly page. Oh and it doesn't have to be a CGI solution...

Mac
Post Reply