Re: Printable Page Question
From the Zope Digest:
Today's Topics:
1. Re: Two Zopes [NEWBIE] (Lennart Regebro) 2. Printable Page Question (Vid Bijelic)
Message: 2 Date: Mon, 17 Dec 2001 09:12:44 -0800 (PST) From: Vid Bijelic <zoops4@yahoo.com> To: zope@zope.org Subject: [Zope] Printable Page Question
Hi,
How to get content of the page you are on (DTML Document)?
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)
Vid
I took the idea from the pages of zope.org a long time ago. In your standard header: <dtml-if pp> < Material that you want as header for the printable page > <dtml-else> < Material you want on your ordinary page, including navigation and images, but not the principal content.> In my case, the ordinary page is a table with only two elements in the main row. The first element, the navigation, is defined here, as is the opening <td> for the second element. The printable page will contain only the second element (but not in a table). </dtml-if> In your standard_footer: <dtml-unless pp> </TD></TR> #If pp is "true," there is no table defined <TR><BR> #and no link to the printable page <TD><p><dtml-var ZopeAttributionButton></p> </TD> <TD> <A HREF="<dtml-var URL>?<dtml-if QUERY_STRING> <dtml-var QUERY_STRING>&</dtml-if>pp=1"> Printable Page (without the Navigation Guide) </A></TD> </TR> </TABLE> </dtml-unless> </BODY></HTML> Hope this helps. Al -- Albert Kinderman California State University, Northridge Department of Systems and Operations Management
I saw another solution somewhere on Zope.org (it's been a while) that I thought was fairly clever. I have used it very successfully to get both printer friendly pages and navigation friendly pages from the same content. Basically what I have is an index_html method in the root of my site that basically looks like this. <dtml-var standard_html_header> <dtml-var content_html> <dtml-var standard_html_footer> I then have another dtml method (in each folder of my site) called "content_html" that holds the actual content. So if I call the method like this: http://myhost.com/mycontent/ the root index_html is called and my content_html method is wrapped in a navigation bar. If it is called like this: http://myhost.com/mycontent/content_html I get the same thing sans navigation. Jason Albert Kinderman <albert.kinderman@csun.edu> writes:
From the Zope Digest:
Today's Topics: 1. Re: Two Zopes [NEWBIE] (Lennart Regebro) 2. Printable Page Question (Vid Bijelic)
Message: 2 Date: Mon, 17 Dec 2001 09:12:44 -0800 (PST) From: Vid Bijelic <zoops4@yahoo.com> To: zope@zope.org Subject: [Zope] Printable Page Question Hi, How to get content of the page you are on (DTML Document)? 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) Vid
I took the idea from the pages of zope.org a long time ago.
In your standard header:
<dtml-if pp>
< Material that you want as header for the printable page >
<dtml-else>
< Material you want on your ordinary page, including navigation and images, but not the principal content.> In my case, the ordinary page is a table with only two elements in the main row. The first element, the navigation, is defined here, as is the opening <td> for the second element. The printable page will contain only the second element (but not in a table).
</dtml-if>
In your standard_footer:
<dtml-unless pp>
</TD></TR> #If pp is "true," there is no table defined <TR><BR> #and no link to the printable page <TD><p><dtml-var ZopeAttributionButton></p> </TD> <TD> <A HREF="<dtml-var URL>?<dtml-if QUERY_STRING> <dtml-var QUERY_STRING>&</dtml-if>pp=1"> Printable Page (without the Navigation Guide) </A></TD> </TR> </TABLE>
</dtml-unless>
</BODY></HTML>
Hope this helps.
Al
-- Albert Kinderman California State University, Northridge Department of Systems and Operations Management
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
On Tue, Dec 18, 2001 at 10:07:54AM -0700, Jason Earl wrote:
So if I call the method like this:
the root index_html is called and my content_html method is wrapped in a navigation bar. If it is called like this:
http://myhost.com/mycontent/content_html
I get the same thing sans navigation.
Do both of these come out as valid html? Normally the standard_html_header and _footer contain all the wrapper <head>, <body>, etc. tags. -- Mike Renfro / R&D Engineer, Center for Manufacturing Research, 931 372-3601 / Tennessee Technological University -- renfro@tntech.edu
Ah, good catch, it's been a while since I actually played with the printable pages, and so I had forgotten that I actually included a small header and a even a style sheet for the printable versions (by checking a "printed" variable). In other words, my method was probably more complicated than the Zope.org one :). Sorry folks, nothing to see here. Jason Mike Renfro <renfro@tntech.edu> writes:
On Tue, Dec 18, 2001 at 10:07:54AM -0700, Jason Earl wrote:
So if I call the method like this:
the root index_html is called and my content_html method is wrapped in a navigation bar. If it is called like this:
http://myhost.com/mycontent/content_html
I get the same thing sans navigation.
Do both of these come out as valid html? Normally the standard_html_header and _footer contain all the wrapper <head>, <body>, etc. tags.
-- Mike Renfro / R&D Engineer, Center for Manufacturing Research, 931 372-3601 / Tennessee Technological University -- renfro@tntech.edu
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Albert Kinderman -
Jason Earl -
Mike Renfro