Typo3,如何动态更改内容 [英] Typo3, how to dynamically change content

查看:74
本文介绍了Typo3,如何动态更改内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据用户选择的选择,有必要交换徽标.(国际人员的徽标和北美的徽标)

There is the requirement, to swap out the logo, based on a choice, the user makes on first visit. (Logo for internationals and logo for north America)

一经想到,可以使用cookie来解决此问题.我实现了一些JavaScript,以根据需要检查和设置Cookie.到目前为止,此方法还可以,但是使用javascript更改徽标不是可行的方法,现在,我正在寻找对此的可能解决方案.

On fist thought this problem can be solved using a cookie. I implemented some javascript, to check and set the cookie if needed. This works fine so far but using javascript to change to logo isn´t the way to go and now I´m looking for possible solutions to this.

如果遵循cookie方法,我需要一种基于cookie换出模板/部分的方法.可能有任何方法可以使用流畅或打字的方式来做到这一点吗?
也许cookie方法根本是处理错误的方法?也许可以使用语言选择或类似的方法来做到这一点?

If following the cookie approach, I´d need a way to swap out the template/partials, based on the cookie. Is there any way to do this using fluid or typoscript perhaps?
Maybe the cookie approach is the wrong way to handle this at all? Maybe this could be done (ab-)using the language selection or something like that?

任何帮助或想法都会受到赞赏.
谢谢!

Any help or ideas are appreciated.
Thanks!

推荐答案

首先:请使用一个问题标题来更准确地描述问题.

First of all: Please use a question title that describes the problem more precise.

使用JavaScript设置Cookie后,您可以将徽标设置为在TypoScript中呈现.

After setting the cookie with your javascript, you can set the logo to render in the TypoScript.

有条件(

With a condition (https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Conditions/Index.html#request-getcookieparams) you can read the cookie parameter and set the logo depending on the cookie.

[request.getCookieParams()['logo'] == 'us']
lib.logoFile = pathToYourLogos/us.svg
[else]
lib.logoFile = pathToYourLogos/international.svg
[end]

这篇关于Typo3,如何动态更改内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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