On Nov 7, 2006, at 23:23, Dustin Frazier wrote:

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
 


I may be unhelpful but... does your static website use css? If so, could you do this by using a print media css file and exactly the same html? That's the approach we tend to use (display: none is helpful here)


cheers

nic

Reply via email to