[TYPO3-english] Print Friendly TemplaVoila page with global caching

Riccardo De Contardi riccardo.decontardi at bhuman.it
Wed May 5 12:05:49 CEST 2010


Hello.

What about this snippet taken from typo3apprentice?


// Create a link to a printable version of the current
// page--complete with all GET parameters needed by
// extensions:

       lib.print_link = TEXT
       lib.print_link {
         // The link text:
         value = Print view
         typolink {
           // Get the id of the current page:
           parameter {
             data = page:uid
           }
           // Add whatever is in the query string:
           addQueryString = 1
           addQueryString {
           // Account for the fact that RealURL etc
           // may have manipulated the query string:
             method = GET
           }
           // Add the 'print' parameter:
           additionalParams = &print=1
           // Do not cache the print version:
           no_cache = 1
         }
       }
       // Changes to the link for when we are ON a print page:
       [globalVar = GP:print > 0]
         lib.print_link {
           // The link text
           value = Normal View
           typolink {
             // Unset the print parameter:
             additionalParams >
             // Make sure we don't turn off
             // the cache for the REGULAR
             // version of the page:
             no_cache = 0
             // Add the entire query string
             // for the current location,
             // EXCEPT for the print and
             // no_cache parameters we
             // introduced:
             addQueryString.exclude  = no_cache,print
           }
         }
       [global]




In data 05 maggio 2010 alle ore 11:33:48, Marc Petralito <koma666 at me.com>  
ha scritto:

> Hi there,
>
> We have a subtemplate for one of our main TemplaVoila templates to  
> display a printer friendly version of our sites ("Render Type: Printer  
> Friendly"). The print preview is basically the content + a header image.
> When deactivating the caching (config.no_cache=1) everything works fine  
> with the print (a new window opens using the templaVoila print template).
>
> As soon as we activate the cache, the printlink still opens a new window  
> but with the normal page (from the cache I assume), not the print  
> friendly version. Although we have used the &print=1 and no_cache=1 for  
> the print link.
>
>
> Is there a way to use global caching and at the same time take the right  
> template?
>
> Kind regards,
>
> Marc Petralito
>
>


-- 
--------------------------------------------
Riccardo De Contardi - Web Developer
B Human Srl - www.bhuman.it
Via Canzio, 15 - 20131 Milano
TEL +39-02-20.23.271 - FAX +39-02-20.240.561
--------------------------------------------


More information about the TYPO3-english mailing list