打字稿条件 &&条件不工作?
这是我的(缩短的)代码:
lib.nav = COA
lib.nav {
50 = HMENU
50 {
[ ... ]
wrap = <nav>|</nav>
}
}
[browser = msie] && [version = <9]
lib.nav.50.wrap = <div id="nav">|</div>
[global]
我所知道的(所做的):
[browser = msie]
单独有效,但对于所有 IE(我需要少于 9 个)- 我安装了
conditions
扩展 - 我搜索了它,但找不到任何完全适合我的问题的
内容 我需要的是一个可以工作的 TS 片段,或者可能是一个解决方法。 谢谢!
This is my (shortened) code:
lib.nav = COA
lib.nav {
50 = HMENU
50 {
[ ... ]
wrap = <nav>|</nav>
}
}
[browser = msie] && [version = <9]
lib.nav.50.wrap = <div id="nav">|</div>
[global]
What I know (did):
[browser = msie]
alone works but for all IE (I need less than 9)- I installed the
conditions
extension - I searched for it but couldn't find anything that would fit exactly my problem
What I need is either a TS snippet that would work or maybe a workaround.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我知道这个问题很老了,但我刚刚解决了类似的问题。在我的例子中,条件失败了,因为我在这样的块内使用了它:
当我重写它时,
它开始按预期
工作我正在使用 Typo3 v6.1
I know the question is quite old, but I've just solved similar problem. In my case condition failed because I used it inside a block like this:
as soon as I rewritten it as
it started working as expected
P.S. I'm using Typo3 v6.1
你的情况看起来是正确的。
那么,也许您有不同的错误?尝试通过测试条件来区分您的问题,而不产生副作用。创建一个新页面,创建一个新的 ts-template 并将此代码放入其中:
现在在浏览器中打开此页面。现在您可以调整您的条件。如果一切正常,则问题出在其他地方。
Your condition looks correct.
So, perhaps you have an different error? Try to separate your problems via testing the condition without side-effects. Create a new page, create a new ts-template and put this code into it:
Now open this page in your browser. Now you can adjust your Conditions. If everything works, the problem is somewhere else.
如果您的脚本存储并嵌套在文件系统中(例如使用 INCLUDE_TYPOSSCRIPT),请尝试将您的条件直接插入到您的typo3后端中,在 主模板的设置字段。
您还可以使用 TypoScript 对象浏览器。
If your scripts are stored and nested in the file-system (e.g. with INCLUDE_TYPOSCRIPT), try to insert your condition directly in your typo3 back-end, in the setup field of your main template.
You can also check if your conditions are working as expected by using the "condition" function at the bottom of the TypoScript Object Browser.
问题是 [浏览器 = msie] 不再工作(T3 4.5+)。即使我在 Internet Explorer 中观看,测试设置始终显示条件不满足。
The problem is that the [browser = msie] isn't working anymore (T3 4.5+). The test setup always shows that the condition is not meet even though I'm watching in Internet Explorer.