我想形成文件路径.在"常量"字段中:
const.siteName = site
templates = fileadmin/templates/{$const.siteName}/
Run Code Online (Sandbox Code Playgroud)
当我查看typoscript对象浏览器时:
[siteName] = site
[templates] = fileadmin/templates/{$const.siteName}/
Run Code Online (Sandbox Code Playgroud)
是否有可能实现这一目标:
[templates] = fileadmin/templates/site/
Run Code Online (Sandbox Code Playgroud)
用const.siteName?
如果有,怎么样?
================================================== =======================
编辑:
接下来我要做的是:
在我的扩展配置中
const.siteName = foo
const.templates = fileadmin/templates/($const.siteName)/
const.path.extensions = ($const.templates)/ext/
Run Code Online (Sandbox Code Playgroud)
我将我的扩展包含在typoscript模板中.在我的扩展程序设置中,我包含这样的插件设置:
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:foo/Configuration/TypoScript/Plugin/formhandler.ts">
Run Code Online (Sandbox Code Playgroud)
在Configuration/TypoScript/Plugin/formhandler.ts中:
plugin.Tx_Formhandler {
/* snip */
settings.predef.member {
templateFile.value = {$const.path.extensions}formhandler/member/step-1.html // doesn't work
//templateFile.value = fileadmin/templates/foo/ext/formhandler/member/step-1.html // works
}
/* snip */
}
Run Code Online (Sandbox Code Playgroud)
对我来说,这个例子很完美:
常量:
const.test = foo
const.test2 = {$const.test}/bar
Run Code Online (Sandbox Code Playgroud)
建立:
page = PAGE
page.10 = TEXT
page.10.value = {$const.test}
page.10.wrap = <p>|</p>
page.20 = TEXT
page.20.value = {$const.test2}
page.20.wrap = <p>|</p>
Run Code Online (Sandbox Code Playgroud)
浏览器输出:
foo
foo/bar
Run Code Online (Sandbox Code Playgroud)
用TYPO3 4.5和8.3测试
看看 TYPO3 NG/ML/论坛:
https://forum.typo3.org/index.php?t=msg&th=212721&goto=740111&#msg_740111 有很多关于如何在打字稿中使用常量的提示:
您可以在常量定义中重用常量,但最多只能重用 10 层。
您可以在条件中使用常量,但只能在设置部分中使用
| 归档时间: |
|
| 查看次数: |
806 次 |
| 最近记录: |