[Zope] Printable Page Question

Lennart Regebro lennart@regebro.nu
Mon, 17 Dec 2001 19:44:13 +0100


From: "Vid Bijelic" <zoops4@yahoo.com>
> How to get content of the page you are on (DTML
> Document)?

The DTML document IS the content.

> I want to make a printer friendly page without
> navigations and images.  The page contains dynamic
> text generated from the database so it is different
> every time.  Something like Printable page on zope.org
>  (I tried to view_source of zope.org printable page
> but couldn't)

What you do is that you create an index_html DTML method in the root of the
site (don't ever use DTML Documents).
The index_html includes all the design. From index_html you also include
another DTML Method (you could call it "content" for example) by a <dtml-var
content> tag.

Now, for each document you want to have on your site, you create a folder.
And in each fodler you create a DTML-method called content that contains the
content of the page. Now you can easily create another DTML-method in the
root called "print", that looks like this:

<dtml-var standard_html_header>
<dtml-var content>
<dtml-var standard_html_footer>

Now every page on your site will have a print-view, by just saying
/bla/foo/bar/print instead of /bla/foo/bar/index_html

Tada!