将参数添加到打字稿中的链接 [英] Add parameter to link in typoscript

查看:29
本文介绍了将参数添加到打字稿中的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的网站设置,因此如果您使用的是移动设备,则可以获得移动设备渲染模板.点击进入主站点,你去

I have my site setup so that if you are on a mobile you get a mobile rendered template. To click to go to the main site you go

index.php?id=??&mainsite=1

这一切正常,但是我的移动模板底部有一个链接,上面写着转到主站点.我希望它转到当前页面 ID 的主模板页面,例如

This all works fine however I have a link at the bottom of my mobile template that says go to main site. I want this to go to the main template page for the current page id eg

index.php?id=page:uid&mainsite=1

如果我这样做

lib.mainsitelink= TEXT
lib.mainsitelink.data = page:uid

我明白

www.example.com/uid

所以当 uid = 3 我得到

so when uid = 3 i get

www.example.com/3

但是如果我执行下面的代码它不起作用

but if i do the below code it doesn't work

lib.mainsitelink= TEXT
lib.mainsitelink.data = index.php?id=page:uid&mainsite=1

有没有办法做我想做的事情或在当前网址的末尾添加一个参数?例如,我正在尝试做的在新闻单页上不太适用.

Is there a way to either do what I am trying to do or add a parameter to the end of the current url? eg what I am trying to do won't quite work on the news single page.

推荐答案

首先,我认为 cobj 文本没有方法数据,因此我会将其更改为值方法.此外,当您想使用 getText 数据类型时,您需要用花括号扭曲变量,然后向其中添加方法 insertData = 1 以便替换花括号内的所有内容.这是一个完整的示例:http://wiki.typo3.org/TSref/getText.当然,您可以使用typolink cobject 来替换页面ID.其次,您可以使用 additionalParams 方法(当然带有拼写链接)添加额外的链接参数(即 get-parameters),或者您可以使用纯 cobj 文本.这是一个带有 cObj 图像和 stdWrap cObj 拼写链接和 tt_news 获取参数的示例.它还会打开一个弹出窗口.

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

              }

这篇关于将参数添加到打字稿中的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆