Typo3 - Druckversion: Unterschied zwischen den Versionen
Aus Wikizone
| Zeile 1: | Zeile 1: | ||
| + | == Klassisch == | ||
TS - Template von J.Weiland | TS - Template von J.Weiland | ||
<pre> | <pre> | ||
| Zeile 98: | Zeile 99: | ||
#page.10.subparts.printlinktext < temp.PRINTLINKTEXT | #page.10.subparts.printlinktext < temp.PRINTLINKTEXT | ||
| + | </pre> | ||
| + | |||
| + | == Modern == | ||
| + | Die obige Version hat verschiedene Nachteile: | ||
| + | * Drucktemplate notwendig | ||
| + | * Ressourcen verbrauch (indizierung der Druckseiten wenn nicht verhindert, Datenbankzugriffe etc | ||
| + | * Druckversion und Druckfunktion des Browsers bringen u.U. verschiedene Ergebnisse. | ||
| + | |||
| + | Deshalb: | ||
| + | |||
| + | Printfunktion des Browsers nutzen und print Stylesheet verwenden um Navigation etc. auszublenden. | ||
| + | |||
| + | Bsp. Grauff.com, CSS - Beispielcss auf Basis des Yahoo Frameworks yui | ||
| + | <pre> | ||
| + | |||
| + | |||
| + | body{ | ||
| + | margin: 0 !important; | ||
| + | margin-top: 130px !important; | ||
| + | padding: 0 !important; | ||
| + | } | ||
| + | #druck{ | ||
| + | display: block !important; | ||
| + | position: absolute; | ||
| + | top: 0; | ||
| + | right: 0; | ||
| + | } | ||
| + | a img { | ||
| + | border:none; | ||
| + | } | ||
| + | #hd,#navi_bottom,#navi_submenu,#navi_meta,.typo3-adminPanel { | ||
| + | display:none; | ||
| + | } | ||
| + | #bd, #doc2 .yui-t7{ | ||
| + | padding:0 !important; | ||
| + | } | ||
| + | #yui-main,#ft,#bd{ | ||
| + | float: left !important; | ||
| + | margin: 0!important; | ||
| + | width: 18cm; | ||
| + | clear: both; | ||
| + | } | ||
| + | #yui-b{ | ||
| + | /*background: pink;*/ | ||
| + | } | ||
| + | .yui-t7 #yui-main .yui-b { | ||
| + | margin:0.5cm !important; | ||
| + | } | ||
| + | |||
| + | |||
| + | ''' | ||
| + | Im Typoscript binden wir einfach einen Link mit einem Javascript Schnipsel ein:''' | ||
| + | |||
| + | Als Bild | ||
| + | <pre> | ||
| + | temp.drucklink = IMAGE | ||
| + | temp.drucklink{ | ||
| + | file = fileadmin/Bilder/printer.gif | ||
| + | altText = Seite drucken | ||
| + | titleText = Seite drucken | ||
| + | wrap = <a href="#" onclick="javascript:window.print()" target="blank">|</a> | ||
| + | </pre> | ||
| + | |||
| + | oder als Textlink | ||
| + | <pre> | ||
| + | temp.drucklink = TEXT | ||
| + | temp.drucklink{ | ||
| + | value = Seite drucken | ||
| + | wrap = <a href="#" onclick="javascript:window.print()" target="_top">|</a> | ||
| + | } | ||
</pre> | </pre> | ||
Version vom 6. August 2008, 16:11 Uhr
Klassisch
TS - Template von J.Weiland
print_page >
print_page = PAGE
print_page {
typeNum = 98
includeCSS {
file1 = fileadmin/templates/css/print.css
file2 = fileadmin/templates/css/muster-content.css
}
10 = TEMPLATE
10 {
template = FILE
template.file = fileadmin/templates/main/print.html
subparts {
logo = IMAGE
logo.file = fileadmin/templates/img/logo.gif
site = TEXT
site.value = TYPO3 Musterprojekt -
date = TEXT
date.data = date:U
date.strftime = %A, %e. %B %Y
titel = TEXT
titel.value = {page:title}
titel.insertData = 1
titel.wrap = Druckversion der Seite: |
host = TEXT
host.data = getenv:HTTP_HOST
host.wrap = URL: |/
url = TEXT
url.typolink {
parameter.data=TSFE:id
returnLast=url
}
content < styles.content.get
left-content < styles.content.getLeft
right-content < styles.content.getRight
copyright = TEXT
copyright.data = date:U
copyright.strftime = © Copyright %Y jweiland.net - Jochen Weiland</p>
}
}
}
[globalVar = GP: L={$english}]
print_page.10.subparts.site.value = TYPO3 Example Project -
print_page.10.subparts.titel.wrap = Printer friendly version of the page: |
print_page.10.date.strftime = %A, %B %e, %Y
[global]
temp.PRINTLINK = IMAGE
temp.PRINTLINK {
file = fileadmin/templates/main/img/print.gif
alttext = Druckversion dieser Seite
stdWrap.postUserFunc = tx_make_printlink
stdWrap {
#ATagParams = class="printlink"
postUserFunc.target = _blank
postUserFunc.include_post_vars = 0
postUserFunc.popup = 0
# postUserFunc.windowparams = (resizable=yes,toolbar=no,scrollbars=yes,menubar=yes,width=800,height=500))
# postUserFunc.windowname = Printversion
}
}
[globalVar = GP: L={$english}]
temp.PRINTLINK.alttext = Printer friendly version
[global]
page.10.subparts.printlink < temp.PRINTLINK
temp.PRINTLINKTEXT = TEXT
temp.PRINTLINKTEXT {
value = DRUCKVERSION
wrap = <span class="printlink"> | </span>
postUserFunc = tx_make_printlink
postUserFunc.target = _blank
postUserFunc.include_post_vars = 0
postUserFunc.popup = 0
#postUserFunc.windowparams = (resizable=yes,toolbar=no,scrollbars=yes,menubar=yes,width=800,height=500))
#postUserFunc.windowname = Printversion
}
[globalVar = GP: L={$english}]
temp.PRINTLINKTEXT.value = PRINT PAGE
[global]
page.10.subparts.printlinktext = TEXT
page.10.subparts.printlinktext.value =
#page.10.subparts.printlinktext < temp.PRINTLINKTEXT
Modern
Die obige Version hat verschiedene Nachteile:
- Drucktemplate notwendig
- Ressourcen verbrauch (indizierung der Druckseiten wenn nicht verhindert, Datenbankzugriffe etc
- Druckversion und Druckfunktion des Browsers bringen u.U. verschiedene Ergebnisse.
Deshalb:
Printfunktion des Browsers nutzen und print Stylesheet verwenden um Navigation etc. auszublenden.
Bsp. Grauff.com, CSS - Beispielcss auf Basis des Yahoo Frameworks yui
body{
margin: 0 !important;
margin-top: 130px !important;
padding: 0 !important;
}
#druck{
display: block !important;
position: absolute;
top: 0;
right: 0;
}
a img {
border:none;
}
#hd,#navi_bottom,#navi_submenu,#navi_meta,.typo3-adminPanel {
display:none;
}
#bd, #doc2 .yui-t7{
padding:0 !important;
}
#yui-main,#ft,#bd{
float: left !important;
margin: 0!important;
width: 18cm;
clear: both;
}
#yui-b{
/*background: pink;*/
}
.yui-t7 #yui-main .yui-b {
margin:0.5cm !important;
}
'''
Im Typoscript binden wir einfach einen Link mit einem Javascript Schnipsel ein:'''
Als Bild
<pre>
temp.drucklink = IMAGE
temp.drucklink{
file = fileadmin/Bilder/printer.gif
altText = Seite drucken
titleText = Seite drucken
wrap = <a href="#" onclick="javascript:window.print()" target="blank">|</a>
oder als Textlink
temp.drucklink = TEXT
temp.drucklink{
value = Seite drucken
wrap = <a href="#" onclick="javascript:window.print()" target="_top">|</a>
}