如何连接Sightly / HTL中的字符串?(How to concatenate strings in Sightly/HTL?)
${properties.targetURL + properties.linkType}
。 解决方法(由@Jens建议)是做如下工作: <sly data-sly-test.concatenated="${'{0}{1}' @ format=[properties.targetURL, properties.linkType]}"></sly>
在HTML输出中连接字符串可以通过将HTL表达式放在一起来完成,即。 ${properties.targetUrl}${properties.linkType}
通过多个表达式选项支持将这两个字符串发送到使用对象: <sly data-sly-use.link="${'core.impl.view.tools.LinkUtils' @ path=properties.targetURL, type=properties.linkType}"></sly>
在一些使用URI操纵的情况下,连接字符串以形成URL可能是可能的
${properties.targetURL + properties.linkType}
. A workaround (suggested by @Jens) is to do something like: <sly data-sly-test.concatenated="${'{0}{1}' @ format=[properties.targetURL, properties.linkType]}"></sly>
Concatenating strings in HTML output can be done by placing HTL expression next to each other, ie. ${properties.targetUrl}${properties.linkType}
Sending both strings to an Use Object is supported via multiple expression options: <sly data-sly-use.link="${'core.impl.view.tools.LinkUtils' @ path=properties.targetURL, type=properties.linkType}"></sly>
Concatenating strings to form an URL might be possible in some cases using URI Manipulation
我有以下代码:
<sly data-sly-use.link="${'core.impl.view.tools.LinkUtils' @ path=properties.targetURL}"></sly>我想将properties.linkType连接到properties.targetURL 。
任何想法如何做到? 我在网上找到了一些例子,但它们似乎不适合我的用例。
I have the following code:
<sly data-sly-use.link="${'core.impl.view.tools.LinkUtils' @ path=properties.targetURL}"></sly>I want to concatenate properties.linkType to properties.targetURL.
Any ideas how it can be done? I've found examples on the net but they don't seem to work for my use case.
最满意答案
这取决于你想要什么样的字符串连接:
不支持使用运算符连接字符串,即。 你不能做That depends on what kind of string concatenation you have in mind:
Concatenating strings using an operator is not supported, ie. you cannot do更多推荐
发布评论