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

╄→尐↘猪︶ㄣ 提交于 2019-12-11 11:54:44

问题


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.


回答1:


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
    }
}



回答2:


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



来源:https://stackoverflow.com/questions/9989803/typo3-how-to-insert-data-into-database-in-a-hook-with-powermail

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!