typolink: set page type for internal links on condition

869 views Asked by At

how can i create a typolink which:

  • reads it's target from a column in tt_content (like header_link f.e.)
  • applies a page type to internal links, but obviously not to external links

f.e., given the values 42 and https://x.org in header_link the desired links should look like:

/<path_to_page_id 42>?type=5
https://x.org

i can't figure out how to apply the page type on the condition internal/external link. this is what i got:

text = TEXT
text.value = click here ;-)

text.stdWrap.typolink {
  parameter.field = header_link

  # following line should only apply if `header_link` is an internal link
  parameter.wrap = |,5
}

edit to clarify: above code produces:

/<path_to_page_id 42>?type=5
https://x.org,5                 <-- not what i want

how do i get the page type for internal links and leave external links untouched?

1

There are 1 answers

1
rob-ot On

Documentation to the TSREF for typolink http://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Typolink/Index.html

adding a page type:

lib.sampleLink = TEXT
lib.sampleLink.value = Open Page 25 with Type 800 in a new window
lib.sampleLink.typolink.parameter = 25,800 _blank