[Templates] printable versions of pages

Dustin Frazier dustin.frazier@alumni.cmu.edu
Tue, 7 Nov 2006 15:23:14 -0800


This is a multi-part message in MIME format.

------=_NextPart_000_0007_01C70280.A4CB3A00
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

I have a 150+ page static website that I built using TT2 and ttree.  No raw
Perl except for a couple of formatting macros in a pre-processing template.
I'm trying to add a feature to every page which links to a printable version
of the page, in this case, the main content of the page without the
surrounding navigation menus, header, footer, etc.  I would obviously like
each printable page built from the same template as its corresponding web
page.
 
I'm wondering if there's a "standard" way that people solve this using
ttree.  Since the printable pages will reference images, styles, links, etc.
in common with the main pages, ideally the printable version of each page
will live in the same directory as it's source page.  I was hoping to use
the "suffix" config parameter of ttree to create something like foo.html and
foo_p.html for each page, but it looks like you can only manipulate the
characters after the dot.
 
My current solution is to 1) create a separate ttree.cfg file that adds a
new lib directory before the normal ones which holds simplified versions of
my page wrapper template (and header, footer, etc.); 2) use ".html" for the
main pages and ".htm" for the printable pages, again via the two different
ttree.cfg files and different "suffix" configs.  Seems like a bit of a hack,
and it's also a little confusing keeping the subtly different filenames
straight.
 
Other solutions I've thought of but haven't tried:
 
- use a non-standard file extension for the printable pages and configure
Apache to serve them up as HTML
- build a separate tree of printable pages that (somehow) still reference
images in the right place
- put printable pages in subdirectories relative to their source page and
again deal with the image references
 
Is there another more elegant solution that I'm missing?
 
Dustin
 

------=_NextPart_000_0007_01C70280.A4CB3A00
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.5730.11" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D624410823-07112006><FONT face=3DArial size=3D2>I have =
a 150+ page=20
static website that I built using TT2 and ttree.&nbsp; No raw Perl =
except for a=20
couple of formatting macros in a pre-processing template.&nbsp; I'm =
trying to=20
add a feature to every page which links to a printable version of the =
page, in=20
this case, the main content of the page without the surrounding =
navigation=20
menus, header, footer, etc.&nbsp; I would obviously like each printable =
page=20
built from the same template as its corresponding web =
page.</FONT></SPAN></DIV>
<DIV><SPAN class=3D624410823-07112006><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D624410823-07112006><FONT face=3DArial size=3D2>I'm =
wondering if=20
there's a "standard" way that people solve this using ttree.&nbsp; Since =
the=20
printable pages will reference images, styles, links, etc. in common =
with the=20
main pages, ideally the printable version of each page will live in the =
same=20
directory as it's source page.&nbsp; I was hoping to use the "suffix" =
config=20
parameter of ttree to create something like foo.html and foo_p.html for =
each=20
page, but it looks like you can only manipulate the characters after the =

dot.</FONT></SPAN></DIV>
<DIV><SPAN class=3D624410823-07112006><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D624410823-07112006><FONT face=3DArial size=3D2>My =
current solution=20
is to 1) create a separate ttree.cfg file that adds a new lib directory =
before=20
the normal ones which holds simplified versions of my page wrapper =
template (and=20
header, footer, etc.); 2) use ".html" for the main pages and ".htm" for =
the=20
printable pages, again via the two different ttree.cfg files and =
different=20
"suffix" configs.&nbsp; Seems like a bit of a hack, and it's also a =
little=20
confusing keeping the subtly different filenames =
straight.</FONT></SPAN></DIV>
<DIV><SPAN class=3D624410823-07112006><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D624410823-07112006><FONT face=3DArial size=3D2>Other =
solutions I've=20
thought of but haven't tried:</FONT></SPAN></DIV>
<DIV><SPAN class=3D624410823-07112006><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D624410823-07112006><FONT face=3DArial size=3D2>- use =
a non-standard=20
file extension for the printable pages and configure Apache to serve =
them up as=20
HTML</FONT></SPAN></DIV>
<DIV><SPAN class=3D624410823-07112006><FONT face=3DArial size=3D2>- =
build a separate=20
tree of printable pages that (somehow) still reference images in the =
right=20
place</FONT></SPAN></DIV>
<DIV><SPAN class=3D624410823-07112006><FONT face=3DArial size=3D2>- put =
printable=20
pages in subdirectories relative to their source page and again deal =
with the=20
image references</FONT></SPAN></DIV>
<DIV><SPAN class=3D624410823-07112006><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D624410823-07112006><FONT face=3DArial size=3D2>Is =
there another=20
more elegant solution that I'm missing?</FONT></SPAN></DIV>
<DIV><SPAN class=3D624410823-07112006><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D624410823-07112006><FONT face=3DArial=20
size=3D2>Dustin</FONT></SPAN></DIV>
<DIV><SPAN class=3D624410823-07112006><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0007_01C70280.A4CB3A00--