[TYPO3-english] Add print feature - news items

Philipp Gampe phil at philippgampe.info
Thu Sep 3 01:29:38 CEST 2009


Am 03.09.2009, 01:03 Uhr, schrieb Bryant, Melanie <mbryant at stauff.com.au>:

> Does anyone know how to add a print option to the standard news plugin
> so that when you bring up the news item it allows you to print that page
> only?
>

try this to generate the print link:


temp.printlink = TEXT

temp.printlink {
         # path to icon
       value = <img  
src="/fileadmin/template2/template_1_FILES/bilder/print.png"  
title="Druckansicht" />
       wrap = <div style="text-align:right; display:block;  
margin-bottom:-1em;"> | &nbsp;
       typolink {
           # link to the current page id with type 10
         parameter = {page:uid}
         parameter.insertData = 1
         useCacheHash = 1
           # add all get parameters from the current URL
         addQueryString = 1
         addQueryString.method = GET
           # remove the page id from the parameters so it is not inserted  
twice
         addQueryString.exclude = id,type
         additionalParams = &type=10
       }
     }

and this for the page

# Print version
print = PAGE
print {
     # TypeNum is 10
   typeNum = 10
     # header data is same as normal page
   headerData < page.headerData
     # Anpassungen
   headerData.40 = TEXT
   headerData.40.value (
     <style type="text/css">
       body {background-color:#E8F3F9;}
     </style>
     <meta name="robots" content="noindex, nofollow">
   )

     # no index
   config.index_enable = 0


      # template
   10 = COA
   10 {
       # Header
     10 = TEXT
     10.value (
       <!-- put header html here -->
       <hr />
       <br />
       )
     }
       # content
     20 =< page.10.subparts.content
       # Backlink
     30 = TEXT
     30 {
       value = back
       wrap = |
       typolink {
           # link to the current page id with type 0
         parameter = {page:uid}
         parameter.insertData = 1
         useCacheHash = 1
           # add all get parameters from the current URL
         addQueryString = 1
         addQueryString.method = GET
           # remove the page id from the parameters so it is not inserted  
twice
         addQueryString.exclude = id,type
         additionalParams = &type=0
       }
     }
       # no robots, google indexing twice and other crap :p
     headerData.2000 = TEXT
     headerData.2000.value = <meta name="robots" content="nofollow,noindex"  
/>
} # end print


The above should work with any content. I hope you get the idea.

Best regards
Phil

-- 
Opera - the fastest newsreader
(I used Thunderbird and Evolution before)


More information about the TYPO3-english mailing list