[TYPO3-dev] Trouble using hooks
    Martin Kutschker 
    martin.kutschker-no at spam-blackbox.net
       
    Sun Jun 15 14:16:20 CEST 2008
    
    
  
Schani schrieb:
> Hello all,
> i have trouble using hooks in my extension.
> I like to insert a record in the page table from my extension.
> 
> Now i insert in ext_localconf.php
> 
> $GLOBALS 
> ['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] 
> = 'EXT:xxx_kunden/class.tx_xxx_kunden.php:tx_xxx_kunden_hook';
> 
> $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamap_afterDatabaseOperations'][] 
> = 'EXT:xxx_kunden/class.tx_xxx_kunden.php:tx_xxx_kunden_hook';
> 
> 
> In class.tx_xxx_kunden.php is:
> 
> <?php
> class tx_xxx_kunden_hook extends t3lib_DB {
t3libn_db !?!?!
> 
> Now on save a new record in my xxx_kunden extension, the hooks create 
> not only one page record, but 1400 ?!?
What happens then? Looks like a recursion to me? You invoke a TCE main 
hook ony any DB operation and so any call to your hook triggers another.
> What went wrong? Is it the right way to do this? Why is the hook create 
> many Records?
What do you want to do? It's not clear to me when you want to create the 
extra page record. Whenever an admin adds a certain record? Maybe you 
want to check at least the $table argument in the hook. Otherwise any 
INSERT/UPDATE will result in a new page.
Masi
    
    
More information about the TYPO3-dev
mailing list