Add parameter to link in typoscript

笑着哭i 提交于 2019-12-06 13:32:36

First off, I don't think that the cobj text has a method data hence I would change that to the value method. Also when you want to use the getText data type you need to warp the variables with curly braces and then add the method insertData = 1 to it so everything inside the curly braces get replaced. Here is a complete example: http://wiki.typo3.org/TSref/getText. Of course you can use a typolink cobject to replace the page id. Second you can add an additional link parameter (i.e. get-parameters) with the additionalParams method (with a typolink of course) or you can use a plain cobj text. Here is an example with a cObj image and stdWrap cObj typolink and tt_news get-parameters. It also opens a popup-window.

             40=IMAGE
             40.file=print.gif                 
             40.stdWrap.wrap = <div>|</div>
             40.stdWrap.typolink.no_cache = 1 
             40.stdWrap.typolink.parameter.data = page:uid
             40.stdWrap.typolink.parameter.wrap = | ,1 print
             40.stdWrap.typolink.additionalParams.cObject = COA
             40.stdWrap.typolink.additionalParams.cObject {

                  10 = TEXT
                  10.data = GPvar : no_cache 
                  10.wrap = &no_cache=|
                  10.required = 1

                  20 = TEXT
                  20.data = GPvar : L
                  20.wrap = &L=|
                  20.required = 1

                  30 = TEXT
                  30.data = GPvar : backPID
                  30.wrap = &backPID=|
                  30.required = 1

                  40 = TEXT
                  40.data = GPvar : tt_news
                  40.wrap = &tt_news=|
                  40.required = 1

              }
biesior

According to typolink reference you need to use additionalParams

lib.myLink = TEXT
lib.mylink.value = Click me!
lib.mylink.typolink.parameter.data = page:uid
lib.mylink.typolink.additionalParams = &mainsite=1
lib.mylink.typolink.useCacheHash = 1

Keep in mind that each (even first) parameter in additionalParams begins with &. Most probably you'll need also make sure that it will generate cHash for proper caching.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!