English Deutsch

Making pdf and print-page links work with tt_news & realURL

RealURL is a great plugin. Having clean looking URL's really adds a professional touch. But a problem occurs with the links for pdf_generator2 and make_printlink on pages that contain a tt_news plugin set to SINGLE view: instead of a nice printable page or pdf the message "no news_id given" is shown.

The reason for the no news message is just what it says: no news_id! This problem is the same as backPid in SINGILE view. To correct the backPid problem it is necessary to simply set dontUseBackPid =1 in the tt_news setup. This way the unique backPid will be available. To correct the problem with the pdf and print links the variables tx_ttnews[tt_news] and tx_ttnews[sViewPointer] must be in the URL.

The code example at the bottom of the page does the following:

  • If the page does NOT have tt_news set to SINGLE view it will leave the link alone and let realURL make it pretty.
  • If the page is a tt_news page set to SINGLE view it will add the tx_ttnews[tt_news] variable to the URL as well as the correct page type.
  • If tt_news is configured to show news items over multiple pages it will get the tx_ttnews[sViewPointer] and no_cache. The no_cache is important because otherwise we would only see the first cached version of the article.

Note: For sone reason the TS setting "no_cache = 1" does not get added to the Typolink. This is why there is the constant "cc=&no_cache = 1".

Typoscript Constants:

pdfIcon = fileadmin/images/pdf.png
printIcon = fileadmin/images/print.png
site = http://www.birkit.com/?id={TSFE:id}
printType = &print=1&type=98
pdfType = &pdf=1&type=123
#must have no cache or the same pdf will be shown
cc = &no_cache=1
#unset article and pointer
article =
pointer =
[globalVar = GP:tx_ttnews|tt_news > 0]
article = &tx_ttnews[tt_news]={GPvar:tx_ttnews|tt_news}
[GLOBAL]
[globalVar = GP:tx_ttnews|sViewPointer > 0]
pointer = &tx_ttnews[sViewPointer]={GPvar:tx_ttnews|sViewPointer}
[GLOBAL]

Typoscript Setup:

[globalVar = GP:tx_ttnews|tt_news > 0]
page.2.marks{
 PDF = COA
  PDF{ 
    10 = IMAGE
    10.file = {$pdfIcon}
    10.stdWrap.typolink{
       parameter.dataWrap = {$site}{$pdfType}{$article}{$pointer}{$cc}
    }
  }
  PRINT = COA
  PRINT {
    10 = IMAGE
    10.file = {$printIcon}
    10.stdWrap.typolink{
      parameter.dataWrap = {$site}{$printType}{$article}{$pointer}{$cc}
    }
  }
}
[ELSE]
page.2.marks{
  PDF = COA
  PDF{ 
    10 = IMAGE
    10.file = {$pdfIcon}
    10.stdWrap.typolink.parameter.field = uid
    10.stdWrap.typolink.additionalParams = {$pdfType}
  }
  PRINT = COA
  PRINT{ 
    10 = IMAGE
    10.file = {$printIcon}
    10.stdWrap.typolink.parameter.field = uid
    10.stdWrap.typolink.additionalParams = {$printType}
  }
}
[GLOBAL]
 
Article Rating:  3.20 (5 votes)
  
Visit TYPO3.org Valid XHTML 1.0 Transitional Valid CSS! [Valid RSS]