Ovid has asked for the wisdom of the Perl Monks concerning the following question:

A number of people have requested "printer-friendly" pages for my CGI course and I would like to accomodate them.

Currently I am building my site using Template Toolkit's ttree utility and and I was wondering if there was an easy way to offer such a thing? I was hoping to use a META directive such as [% META printer_friendly=1 %] in my documents to make a "Printer Friendly" link that would point to a separate page. In other words, I'd like to write two documents from one template using ttree and have the documents link to each other. Of course, I'll happily consider other options.

If you're familiar with the excellent Perl Template Toolkit book, I'm using code nearly identical to the static Web site code in Chapter 11.

Crossposted to the Template Toolkit list.

Cheers,
Ovid

New address of my CGI Course.

  • Comment on Template Toolkit's ttree: multiple outputs from one file

Replies are listed 'Best First'.
Re: Template Toolkit's ttree: multiple outputs from one file
by Zaxo (Archbishop) on Oct 10, 2004 at 03:07 UTC

    It seems like switching stylesheets should be a good way to do that.

    After Compline,
    Zaxo

Re: Template Toolkit's ttree: multiple outputs from one file
by Mr. Muskrat (Canon) on Oct 10, 2004 at 03:08 UTC

    I usually will stick to one page but add CSS print media. Print previews will (usually) show the page as it will be printed.

Re: Template Toolkit's ttree: multiple outputs from one file
by tachyon (Chancellor) on Oct 10, 2004 at 03:32 UTC

    This is one area where javascript and a simple <div> in your template can make it very easy. See my example at Re: Printer Friendly Pages. Because this is all client side you save the round trip to the server and recreating dynamic data just to make it printer friendly. I use a popup window, but you could quite happily overwrite the current windows content with printer friendly content.

    cheers

    tachyon

      Thanks, applied :)

      There are still a few quirks that I need to work out, for the time being, I just made every page "printer friendly" and figured I'd be done with it for the time being.

      Cheers,
      Ovid

      New address of my CGI Course.

        Another workaround of the history issue is just to have a css link class that retains the unvisitied color when visited.

        cheers

        tachyon