DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
EXT: Print Link¶
Author: | Kasper Skårhøj |
---|---|
Created: | 2002-11-01T00:32:00 |
Changed by: | Ernesto Baschny |
Changed: | 2010-03-16T22:06:31.130000000 |
Email: | ernst@cron-it.de |
Info 2: | |
Info 3: | |
Info 4: |
EXT: Print Link¶
Extension Key: cron_printlink
Copyright 2005-2008, ernst@cron-it.de, <ernst@cron-it.de>
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
The content of this document is related to TYPO3
- a GNU/GPL CMS/Framework available from www.typo3.com
Table of Contents¶
EXT: Print Link 1
Introduction 1
What does it do? 1
Users manual 2
Adminstration 2
Configuration 2
plugin.tx_cronprintlink_pi1 2
plugin.tx_cronprintlink_pi2 3
Footer URLs 4
Caching and Non-Caching 4
Known problems 4
To-Do list 4
Changelog 4
Introduction¶
What does it do?¶
This extention add an easy way of adding a link to the “print version” (page type=98) of your page. Its output can be customized with TypoScript and is internationalizable through locallang.php (and _LOCAL_LANG).
Based on make_printlink by Jens Ellerbrock < je@hades.org > and Dominic Brander < dbrander@snowflake.ch >.
A second plugin allows you to add a footer to your print page, telling the user where the original page is located (URL).
A third feature is that this extension is able to generate a list of URLs in the footer of the print view and add references in the text to those URLs. Example:
Users manual¶
The user should never need to do anything with this module.
Adminstration¶
Installing the extention will give you two plugins (in form of TypoScript objects) to add to your TypoScript templates and one setting in your CONFIG object:
- plugin.tx_cronprintlink_pi1 – this will add a link to the current page, but changing to type 98 (print version). Customizable as javascript popup. See Configuration later.
- plugin.tx_cronprintlink_pi2 – this is meant to be used in the print version (type 98), adding a text “This page can be found at http://url.../”.
- config.footerUrl = 1 will generate a footer with URLs on your page. See Configuration for more details.
Configuration¶
Both plugins can be configured through TypoScript. A couple of Constants makes it easy for an non-technical administrator to change some basic behaviour using the CONSTANT EDITOR.
plugin.tx_cronprintlink_pi1¶
type¶
Property
type
Data type
int
Description
The page-type where your print version template is. Should normally be 98.
Default
98
printParam¶
Property
printParam
Data type
string
Description
If instead of changing the page type just need another parameter (e.g. with TemplaVoila print=1), then set this parameter. The “type” above is then ignored.
Example:
temp.printlink < plugin.tx_cronprintlink_pi1
temp.printlink.printParam = print=1
Default
target¶
Property
target
Data type
string
Description
If you are not using the popup javascript, ou can define a target where the print version will open
This setting is configurable through the CONSTANT EDITOR.
Default
_blank
ATagParams¶
Property
ATagParams
Data type
string / stdWrap
Description
Parameters to be added to the print link's A-tag “as is”.
Example:
temp.printlink < plugin.tx_cronprintlink_pi1
temp.printlink.ATagParams = alt=”Print {field:title}”
temp.printlink.ATagParams.insertData = 1
Default
noBlur¶
Property
noBlur
Data type
boolean
Description
If set, will add a onfocus="blurLink(this);” to the link
Default
false
include_post_vars¶
Property
include_post_vars
Data type
boolean
Description
If set, the received POST variables (i.e. the parameters you don't see in the URL) will be appended as GET variables to the URL. This may be needed if you want to generate dynamic data that uses POST data (the search result for example).
This setting is configurable through the CONSTANT EDITOR.
IMPORTANT NOTE: if you set this parameter it is possible that passwords and other sensible information will get encoded in the URL and thus be logged in proxy-logs for example or even cached with the page and displayed to a potential third-party!
Default
false
ignore_post_vars¶
Property
ignore_post_vars
Data type
string
Description
Comma separated list of variables which won't get added to the GET variable to the URL if they have been send as POST in the page to be printed. This is way of avoiding login-data to be included in the generated URLs (which might be cached!)
This setting is configurable through the CONSTANT EDITOR.
Default
pass,user,logintype
popup¶
Property
popup
Data type
boolean
Description
If set, the link will be created as a JavaScript that will open the print version in a smaller window.
This setting is configurable through the CONSTANT EDITOR.
Default
true
popupWindowparams¶
Property
popupWindowparams
Data type
string
Description
Sets the window parameters for the JavaScript popup window
This setting is configurable through the CONSTANT EDITOR.
Default
resizable=yes,toolbar=no,scrollbars=yes,menubar=yes,width=600,height=5 00
popupWindowname¶
Property
popupWindowname
Data type
string
Description
Sets the name of the popup window
Default
popupHref¶
Property
popupHref
Data type
string
Description
If using popups, the default is to keep the original URL in href so that clients without javascript still work. Set this to “#” if you want to have “#” in href. For the sake of accessibility, you are discouraged to use this setting.
Default
linkContent¶
Property
linkContent
Data type
->cObject
Description
What do you want to be the text of the link. This can be any content object, like TEXT, IMAGE, etc.
Example:
temp.printlink < plugin.tx_cronprintlink_pi1
temp.printlink.linkContent = IMAGE
temp.printlink.linkContent.file = fileadmin/print.gif
If you don't set this property, you will get a text “Print”, which can even be translated to different languages: Useful, if you have a multilanguage site (each language will have a different print link text)
Default
stdWrapContent¶
Property
stdWrapContent
Data type
stdWrap-options
Description
stdWrap for the content of the link, e.g. for the text “Print”
Default
stdWrap¶
Property
stdWrap
Data type
stdWrap-options
Description
stdWrap for the whole generated link. Useful to wrap something around the link:
Example:
temp.printlink < plugin.tx_cronprintlink_pi1
temp.printlink.stdWrap.wrap = <div class=”print”>|</div>
Default
_LOCAL_LANG.[lang-key].[label_key]¶
Property
_LOCAL_LANG.[lang-key].[label_key]
Data type
strings
Description
Currently only one label_key that you can set: print_version
If you make other translations than those already found in pi1/locallang.php, please send them to me, so I can include them in future releases.
Default
plugin.tx_cronprintlink_pi2¶
_LOCAL_LANG.[lang-key].[label_key]¶
Property
_LOCAL_LANG.[lang-key].[label_key]
Data type
strings
Description
Currently only one label_key that you can set: home_at
If you make other translations than those already found in pi1/locallang.php, please send them to me, so I can include them in future releases.
Default
prefix¶
Property
prefix
Data type
cObject
Description
Content to prefix the current URL with. Defaults to prefixing with the “home_at” string from locallang.xml
Default
noPrefix¶
Property
noPrefix
Data type
boolean
Description
If you don't wany any prefix (not the “home_at” string and not the custom “prefix”), set this to true.
Default
stdWrapPrefix¶
Property
stdWrapPrefix
Data type
->stdWrap
Description
Call stdWrap with the prefix as content
Default
suffix¶
Property
suffix
Data type
cObject
Description
Same as prefix, but to be placed after the URL
Default
stdWrapURL¶
Property
stdWrapURL
Data type
->stdWrap
Description
Call stdWrap on the URL that will be displayed
Default
stdWrap¶
Property
stdWrap
Data type
->stdWrap
Description
Call stdWrap on the whole string that is generated (<prefix><url><suffix>).
Default
Caching and Non-Caching¶
Under TYPO3 currently a plugin has to be either an USER object (meaning its output can be cached by TYPO3) or an USER_INT object (meaning that on each page-rendering, the plugin will get called). By default, this script comes as an USER object, so that it performs nicely on static content, but it doesn't work right on “dynamic” content (e.g. search results).
For best performance with this script, we need a way to: a) get the output (the link) cached if there are no “dynamic” stuff on the current page and b) embed as an USER_INT if the current page has dynamic content (which depend on the GET/POST parameters). The only solution you have so far is to use ext-Templates to make the script USER_INT on certain pages-trees.
So create the main template as usual. Decide on where you want the output not to be cached (e.g. in the search-result page, or in the news page). Create an ext-Template on that tree, with something like:
plugin.tx_cronprintlink_pi1 = USER_INT
This will make sure that the output of this script will never get cached, so it will handle nicely any kind of dynamic parameters that are not handled by the cache.
Note: The output of tt_news is dynamic, but its output gets cached together with all parameters (cHash)! So you don't need to make an USER_INT of this on tt_news pages!
Known problems¶
Currently only the caching/non-caching problems, but there is the ext- Template workaround.
To-Do list¶
Nothing so far
Changelog¶
1.0.0
- Bugfix for broken link generated when TYPO3 is configured with config.absRefPrefix = /. Now uses proper API method so it works in all cases out of the box. Thanks for Francois Suter for the patch.
- Bugfix, now pi2 can also have LOCAL_LANG settings overwritten by TypoScript, this has not been the case before. Thanks to Daniel Chabrol
- Added danish translations. Thanks to Thomas Clausen.
- Added french translation to pi2, Thanks to Dominik Wezel
- Fixed documentation bug: Thanks to Jonathan Starck
- Rised version number to 1.0.0 as this has proven to be stable already. :)
0.4.0
New feature: Footer URLs.
0.2.4
- Accessibility: if using JavaScript, keep the original URL in href. New setting “popupHref” is available for those who for some reason need the old behaviour (popupHref = # for having href=”#”). Thanks for Tobias Pinnekamp for the idea.
- Bugfix: TypoScript setting _LOCAL_LANG was not being using in pi1. Fixed. Thanks for Tobias Pinnekamp for the report.
0.2.3
Called htmlspecialurl around the URI so that the generated A-HREF attribute is XHTML compliant even if it contains characters like '&'. Thanks to Marco Seiler for reporting.
0.2.2
- Bugfix: it is now possible to create a “printlink” back to normal view (type=0). Thanks to Alistair MacDonald for reporting
- Added documentation for some pi2 TS-settings that were always available, but never documented.
0.2.1:
Bugfix for missing “&” in front of “print=1” parameter (e.g with TemplaVoila using printParam): Thanks to Francois Suter for reporting
0.2.0:
Added ignore_post_vars option: thanks to Jan-Philipp Halle for the idea and the code
0.1.2:
Documentation fix
0.1.1:
Added printParam option, so it can also be used with TemplaVoila (print=1 instead of type=98)
0.1.0:
Based on make_printlink version 1.5.2, but added a lot of functionality
EXT: Print Link - 5