[TYPO3-dev] Trouble using hooks
Martin Kutschker
martin.kutschker-no at spam-blackbox.net
Sun Jun 15 17:08:03 CEST 2008
Schani schrieb:
> Hello Masi,
>
>>>
>>> <?php
>>> class tx_xxx_kunden_hook extends t3lib_DB {
>>
>> t3libn_db !?!?!
>
> I t3lib_db not the correct Class?
No. There's no need to extend it. The hook class can be a base class.
The only reason for extending t3lib_db is DB logging for profiling or
accessing other DBs like the DBAL extension does.
>>
>> 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.
>
> Yes, each new record should create a new sysfolder. Thats what i want.
Well, if you really want to create the pages on any INSERT to your
product table then you're on te right track. But like I said in my
previous answer check the $table argument. Otherwise any change on any
table will create a new page. And don't set the uid as it won't be used
anyway if you request a new record. OTOH you can probably use the $id
argument as your pid.
What I don't know is how you can check if the hook is called for an
INSERT or for an UPDATE. Your usecase asks for a new page only for an
INSERT.
BTW, you simpy can use a fixes key like NEWmyPage. No need to fuss
around with md5 and rand. TCEmain only checks for NEW at the beginning
and requires it to be unique in the array - simple if you have only one
item in the array :)
Masi
More information about the TYPO3-dev
mailing list