Forums / Setup & design / Printable page

Printable page

Author Message

Ivo Lukac

Wednesday 18 June 2008 4:41:35 am

Hi Horst,

Tricky parts is to detect in full view template is the page in print layout.
A bit dirty solution is to use http://ez.no/developer/contribs/template_plugins/ezservervars to get REQUEST_URI server variable and check if it contains "layout/set/print" string.
If this condition is true you can call some other template for print view, and if false show the normal full view.

Greetz

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Jon Staines

Wednesday 18 June 2008 4:52:34 am

Try experimenting with the layout override condition:
http://ez.no/doc/ez_publish/technical_manual/4_0/reference/template_override_conditions

This should let you make an override for when the page (or anything else you can make overrides for) is being viewed in the print layout.

Horst Lindlbauer

Wednesday 18 June 2008 5:54:00 am

Thanks for the suggestions.
Since I need print versions for many templates, it would be convenient to have one place to store them to and not to have to write an override in every case.

I found something interesting here:
http://ez.no/doc/ez_publish/technical_manual/3_10/templates/the_pagelayout/the_page_head
Balazs states that the following line turns off alternate/print layout:

{include uri='design:page_head.tpl' enable_print=false()}

So, this line "turns it on"? (Well, what does this mean exactly?)

{include uri='design:page_head.tpl' enable_print=true()}

It would be nice to know where to store the print layout templates...
Does anybody know something about the role of layout.ini?

---------------------------------------
http://www.lbm-services.de

Jon Staines

Wednesday 18 June 2008 6:32:26 am

{include uri='design:page_head.tpl' enable_print=true()} would work although it defaults to enable_print=true() in the standard template so you could leave off that part. It basically adds the line

<link rel="Alternate" href={concat("layout/set/print/",$site.uri.original_uri)|ezurl} media="print" title="{'Printable version'|i18n('design/standard/layout')}" />

into the head of a page.

If you have the standard website interface install have a look at the following files:
extension/ezwebin/design/ezwebin/templates/pagelayout.tpl
design/standard/templates/page_head.tpl
design/standard/templates/link.tpl

Pagelayout.tpl contains the include line for page_head, page_head.tpl sets the default values for enable_print and includes the link.tpl template if needed.

You can make a folder for your print overrides just add the folder into the override.ini.append.php entry, such as:

[print_article]
Source=node/view/full.tpl
MatchFile=print/article.tpl
Subdir=templates
Match[class_identifier]=article
Match[layout]=print

See how the MatchFile line goes to print/article.tpl.

Not sure about all the details of the layout.ini but at its most basic it allows you to view the pages with a different pagelayout template or content type by using the /layout/set/SOMETHING/pathToContent in the URL. You use layout.ini to say which pagelayout to use such as:

[minimal]
PageLayout=minimal_pagelayout.tpl

If you then went to http://somedomain/layout/set/minimal/content/view/full/2 it would use minimal_pagelayout.tpl instead of pagelayout.tpl