Using this extension you can wrap any content element in a link pointing to the page using stdwrap.postUserFunc. The following code gives some examples:
[...]
page.100 = IMAGE
page.100.file = fileadmin/print.gif
page.100.stdWrap.postUserFunc = tx_make_printlink
[...]
[...]
page.110 = TEXT
page.110.value = printable version
page.110.postUserFunc = tx_make_printlink
page.110.postUserFunc.target = _blank
page.110.postUserFunc.make_user_int = 0
[...]
Please note that the TEXT object contains the stdWrap at base level.
temp.PRINT = TEXT
temp.PRINT.value = printpage
temp.PRINT.postUserFunc = tx_make_printlink
temp.PRINT.postUserFunc.include_post_vars = 1
temp.PRINT.postUserFunc.target = _blank
temp.PRINT.postUserFunc.popup = 1
temp.PRINT.postUserFunc.windowparams = (
resizable=yes,toolbar=no,scrollbars=yes,menubar=no,width=800,height=500
)
temp.PRINT.postUserFunc.windowname = printwindow
[...]
page.120 >
page.120 < temp.PRINT
If you use the Template Auto-Parser extension and you want to put the link somewhere on your page, you may need to put it in a COA with another element. If you want to place it below the content for example you woud change
subparts.content < styles.content.get
to something like
subparts.content = COA
subparts.content {10 = CONTENT
10 < styles.content.get
20 < temp.PRINT
}
and define temp.PRINT like above.
Please note that the link will be generated as a USER_INT object by default, i.e. that the link will be generated after the page has been pulled from the cache. If you want to go for maximum performance you can disable that with the parameter postUserFunc.no_user_int = 1 which will generate and cache the link. This is only recommended if you are sure that there are no USER_INT objects on the page that set POST or GET parameters. If you don't understand what i'm writing about leave it at default.
Altenatively you can also use the function tx_open_printlink which will generate the opening tag for the link. You will need to generate the closing </a> tag yourself´. Example:
page.36= USER_INT
page.36.userFunc = tx_open_printlink
page.37=TEXT
page.37.value = Printlink
page.38=HTML
page.38.value = </a>
Please note that this extension only creates the link to the printable version. You will still need to either add plugin.alt.print (98) to “Include static” in your template or create a special template for the print version. Here's a very simple example that contains only one line and the main content:
print_page = PAGE
print_page {typeNum = 98
10 = TEXT
10.value = This is the printable version:<hr>
20 = CONTENT
20 < styles.content.get
}