【问题标题】:Using special characters as CASE keys in typoscript在打字稿中使用特殊字符作为 CASE 键
【发布时间】:2018-07-24 12:12:21
【问题描述】:

我正在尝试通过 powermail 扩展程序向不同的收件人发送邮件,具体取决于用户在表单下拉列表中选择的值。在powermail documentation 中描述了这种动态接收器 的做法。基本上:

receivers1.email = CASE
receivers1.email {

    key.data = GP:tx_powermail_pi1|field|receiver

    1 = TEXT
    1.value = receivera@domain.org

    default = TEXT
    default.value = receiverb@domain.org
}

现在我面临以下问题:“接收者”的值不是数字(如示例中所示),而是下拉列表中的文本值。其中一些包含空格,其中一些包含变音符号(öäüß)。如果我尝试添加……

Not wörking = TEXT
Not wörking.value = anotheremail@nowhere.org

Typo3 会抱怨并且不会更新任何内容。 (财产不好! 您必须输入包含字符 a-z、A-Z 和 0-9 的属性,不能有空格!没有更新!)

我尝试用反斜杠简单地“转义”禁用字符,但不起作用。有通过stdWrap rawUrlEncode 转换key.data 的想法,但也没有用。谷歌上来了with this solution,但是不明白怎么回事,无法使用成功。

我该如何解决这个问题?非常感谢您的任何提示!

【问题讨论】:

    标签: typo3 typoscript typo3-8.x typo3-extensions powermail


    【解决方案1】:

    我非常喜欢您的 rawUrlEncode 解决方案。您能在这里向我们提供您的解决方案吗?根据这个online converter,结果应该是这样的:

    key.data = GP:tx_powermail_pi1|field|receiver
    key.stdWrap.rawUrlEncode = 1
    
    Not%20w%C3%B6rking = TEXT
    Not%20w%C3%B6rking.value = anotheremail@nowhere.org
    

    可能对于每个 CASE,都不允许使用像“%”这样的符号。在这种情况下,您可能会参考“替换”功能。 https://docs.typo3.org/typo3cms/TyposcriptReference/8.7/Functions/Replacement/Index.html#replacement

    key.data = GP:tx_powermail_pi1|field|receiver
    key.stdWrap.replacement {
      10 {
          search.char = 32
          replace = _
      }
      // Add umlauts and other signs!
    }
    
    Not_wörking = TEXT
    Not_wörking.value = anotheremail@nowhere.org
    

    【讨论】:

    • 是的,你是对的,'%' 也是不允许的。我会试试你的replacement 方法,看起来不错!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-25
    • 2017-02-03
    • 2020-04-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多