[TYPO3-dev] having trouble writing a custom hook
John Nicholas
typo3user at mobosplash.com
Fri Mar 2 16:01:19 CET 2007
Dmitry Dulepov wrote:
> John Nicholas wrote:
>> For now I just need to get the hook to trigger but must be missing
>> something. My extension is called 'bnews_ondemandvideo'. In the
>> ext_localconf.php I have this line:
.....
>
> You need to follow typo3 conventions if you want it to be called.
> Firsts, your class name is wrong. All classes in extensions must start
> with tx_. Typo3 will not call any class that does not match this
> convention.
>
> Than you could use devLog instead of your own file writing...
>
Thanks for the quick reply. I didn't realize there was enforcement of
the tx_ prefix. I rebuilt the extension with that naming convention in
mind but still am not getting anything in the server logs or my log
file. That's the part I find most confusing. I would expect some kind of
file not found error if I am pointing in the wrong place. I don't know
how I can debug anything without any errors.
Here's my updated code.
in ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][]
=
'EXT:tx_bnews_ondemandvideo/class.tx_bnews_ondemandvideo_tcemain_processdatamap.php:tx_bnews_ondemandvideo_tcemain_processdatamap';
and in class.tx_bnews_ondemandvideo_tcemain_processdatamap.php
<?php
class tx_bnews_ondemandvideo_tcemain_processdatamap {
function processDatamap_postProcessFieldArray($status, $table, $id,
&$fieldArray, &$this){
$myFile = "/usr/local/apache2/htdocs/testFile.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
fwrite($fh, "called | $status | $table");
fclose($fh);
}
}
?>
More information about the TYPO3-dev
mailing list