TYPO3 - 使用powermail向表中添加值

时间:2012-06-26 16:10:10

标签: typo3 typoscript

我制作了一个表单,以便用户可以注册他们的电子邮件地址进行比赛。我使用powermail表单,有人告诉我使用dbEntry执行此操作,但我不知道如何做到这一点。到目前为止,这是我的代码:

plugin.tx_powermail_pi1{
    dbEntry{

        tt_address._enable = TEXT
        tt_address._enable.value = 1

        tt_address.email = TEXT
        tt_address.email.value = ????
    }

    debug.output = all
}​

我被告知激活_enable以启用数据插入。但现在我不知道如何访问表单的字段值。我可能应该使用模板ID,即### UID71 ###,但我不知道如何。

1 个答案:

答案 0 :(得分:2)

根据official documentation,您可以这样做:

plugin.tx_powermail.settings.setup {
    dbEntry {
        # enable or disable db entry for tt_address
        tt_address._enable = TEXT
        tt_address._enable.value = 1

        # write only if field email is not yet filled with current value
        # (update: update values of existing entry)
        # (none: no entry if field is filled)
        # (disable: always add values don't care about existing values)
        tt_address._ifUnique.email = update

        # fill table "tt_address" with field "pid" with the current pid (e.g. 12)
        tt_address.pid = TEXT
        tt_address.pid.data = TSFE:id

        # fill table "tt_address" with field "tstamp" with the current time as timestamp (like 123456789)
        tt_address.tstamp = TEXT
        tt_address.tstamp.data = date:U

        # fill table "tt_address" with field "name" with the value from powermail {firstname}
        tt_address.name = TEXT
        tt_address.name.field = firstname

        ...
    }
}

我还找到了一个(较旧的)forum post(德语),其中包含使用用户会话数据的示例:

# table "tt_address" with field "last_name" is the value from powermail (tt_content uid 88) field uid18 (###uid18###)
tt_address.last_name = TEXT
tt_address.last_name.data = TSFE:fe_user|sesData|powermail_88|uid18