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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 06:13:44
Script start
Timing: Jan 19 2025 06:13:44
Module start 'layout'
Timing: Jan 19 2025 06:13:44
Module start 'content'
Timing: Jan 19 2025 06:13:45
Module end 'content'
Timing: Jan 19 2025 06:13:45
Script end

Main resources:

Total runtime0.7782 sec
Peak memory usage4,096.0000 KB
Database Queries61

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0046 590.6875152.6094
Module start 'layout' 0.00460.0027 743.296939.8906
Module start 'content' 0.00730.7696 783.1875588.9375
Module end 'content' 0.77680.0013 1,372.125018.3281
Script end 0.7782  1,390.4531 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.3879160.0002
Check MTime0.00130.1700160.0001
Mysql Total
Database connection0.00070.087510.0007
Mysqli_queries0.722792.8714610.0118
Looping result0.00050.0679590.0000
Template Total0.751796.620.3758
Template load0.00170.222320.0009
Template processing0.749996.368920.3750
Template load and register function0.00020.021210.0002
states
state_id_array0.00070.091110.0007
state_identifier_array0.00080.102420.0004
Override
Cache load0.00140.1832410.0000
Sytem overhead
Fetch class attribute can translate value0.00070.095930.0002
Fetch class attribute name0.00110.143560.0002
XML
Image XML parsing0.00270.340530.0009
class_abstraction
Instantiating content class attribute0.00000.001670.0000
General
dbfile0.00240.3025230.0001
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
12content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 32
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs