TYPO3:在内容元素链接中使用 TypoScript 常量
TYPO3: use TypoScript constants in content element links
我们有一个项目,其中一些页面 ID 是使用 TS 常量集中定义的。我们自己的控制器和流体模板可以获取这些常量并使用它们为其他页面生成 link。所以可以通过改变TS常量值来集中切换目标页面:
plugin.tx_foobar {
# customcategory=...
settings {
# customSubcategory=...
# cat=...
fooPageUid = 21
这可以在流体模板中使用,以生成一些 link 到 uid 为 21 的页面:
<a href="/index.php?id={settings.fooPageUid}"...
是否可以使用内容元素 link 部分中的 TS 常量?
例如在标题 CE 中插入 link 时,页面选择器会插入如下内容:
t3://page?uid=21
我们想使用 TS 常量而不是 hard-selected 21。像这样:
t3://page?uid={settings.fooPageUid}
这是为了说明目的,因为它显然不正确 - 因此这个问题。
通过 TS 将常量赋值到 {settings}
数组中:
常量:
plugin.tx_foobar.settings.myConstant = 123
设置:
plugin.tx_foobar.settings.myConstant = {$plugin.tx_foobar.settings.myConstant}
然后在 Fluid 中使用 {settings.myConstant}
并将其作为 pageUid
或 parameter
参数传递,以 ViewHelper 需要的为准。
Is there a possibility to use the TS constant from a content elements link section?
不,没有,但可以覆盖生成 "link wizard" 弹出窗口的 PHP class 并添加选项卡,进行不同的选择器或其他自定义.
我们有一个项目,其中一些页面 ID 是使用 TS 常量集中定义的。我们自己的控制器和流体模板可以获取这些常量并使用它们为其他页面生成 link。所以可以通过改变TS常量值来集中切换目标页面:
plugin.tx_foobar {
# customcategory=...
settings {
# customSubcategory=...
# cat=...
fooPageUid = 21
这可以在流体模板中使用,以生成一些 link 到 uid 为 21 的页面:
<a href="/index.php?id={settings.fooPageUid}"...
是否可以使用内容元素 link 部分中的 TS 常量?
例如在标题 CE 中插入 link 时,页面选择器会插入如下内容:
t3://page?uid=21
我们想使用 TS 常量而不是 hard-selected 21。像这样:
t3://page?uid={settings.fooPageUid}
这是为了说明目的,因为它显然不正确 - 因此这个问题。
通过 TS 将常量赋值到 {settings}
数组中:
常量:
plugin.tx_foobar.settings.myConstant = 123
设置:
plugin.tx_foobar.settings.myConstant = {$plugin.tx_foobar.settings.myConstant}
然后在 Fluid 中使用 {settings.myConstant}
并将其作为 pageUid
或 parameter
参数传递,以 ViewHelper 需要的为准。
Is there a possibility to use the TS constant from a content elements link section?
不,没有,但可以覆盖生成 "link wizard" 弹出窗口的 PHP class 并添加选项卡,进行不同的选择器或其他自定义.