简体   繁体   中英

Typo3: How to insert data into database in a hook with powermail

I need to insert data into a column in the database.

Which hook should I use?

How can I insert the data?

I'm very confused over how powermail works with hooks.

For example, You could use this hook : PM_SubmitBeforeMarkerHook , it contains $sessionData , with submitted data.

ext_localconf.php

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_SubmitBeforeMarkerHook'][$_EXTKEY] = 'EXT:'.$_EXTKEY.'/Ressources/Private/PHP/Hooks/powermail/class.user_PM_SubmitBeforeMarkerHook.php:&user_PM_SubmitBeforeMarkerHook';

class.user_PM_SubmitBeforeMarkerHook.php

<?php

class user_PM_SubmitBeforeMarkerHook {
    public function PM_SubmitBeforeMarkerHook (tx_powermail_submit &$pObj, &$markerArray, &$sessionData) {
         // Save data
    }
}

Just as addition: Powermail is able to create or edit tables in the database on its own. You can fe create tt_news records via powermail just by define the mapping via TypoScript. Have a closer look into the manual for that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM