Learn about the top 2016 CMS trends. Read on.


The following TypoScript works pretty well if you have dedicated print and send to friend pages. However, if you have a dynamic print or email pages, this method isn’t so great.

This method assumes you’re using TemplaVoila’s alternate templates for print. Hence the &print=1.

Call the following into your template via TypoScript via lib.printLinks to use it in your template.

lib.print_url = TEXT
lib.print_url {
	value =  Print
       typolink {
               parameter = 261 640x480:status=1,menubar=1,scrollbars=1,resizable=1,location=1 - Print Story
               addQueryString = 1
               addQueryString {
                       method = GET
               }
               additionalParams = &print=1
       }
}

lib.tip_url = TEXT
lib.tip_url {
	value =  Email
       typolink {
               parameter = 210 1000x600:status=1,menubar=1,scrollbars=1,resizable=1,location=1 - Email Story
               addQueryString = 0
               addQueryString {
                       method = GET
               }
		additionalParams.cObject = COA
		additionalParams.cObject {
			# This part generates the "tipUrl" parameter in the
			# correct format. (rawUrlEncoded)
			10 = COA
			10 {
				# This part adds the domain (baseUrl) to the link URL
				10 = TEXT
				10.data = TSFE:baseUrl

				# This part creates an URL pointing to the current page
				# including all parameters from the query string.
				20 = TEXT
				20.typolink.parameter.data = page:uid
				20.typolink.addQueryString = 1
				20.typolink.addQueryString.exclude = id
				20.typolink.addQueryString.method = GET
				20.typolink.returnLast = url

				# Then everything is rawUrlEncoded so it can
				# be placed as a single parameter in the link URL
				stdWrap.rawUrlEncode = 1
			}
			# And finally the parameter data is wrapped with the "&tipUrl=" parameter.
			wrap = &tipUrl=|
		}
       }
}

### articleLinks
temp.articleLinks = COA
temp.articleLinks {
  ### Printlink
  10 < lib.print_url

  20 = HTML
  20.value =

  60 < .20

  70 < lib.tip_url
  80 < .20
}

lib.printLinks < temp.articleLinks

Alternately, for print pages, you could use CSS to hide the unneeded elements in your current template when printing and to avoid the need to have a specific print page.

See these scripts in action at ManhattanReview.com.

References

Related Links

Originally posted 2009/03/03

Still stuck? Write us.