[TYPO3-dev] having trouble writing a custom hook

Dmitry Dulepov 9f4eetb02 at sneakemail.com
Fri Mar 2 15:34:41 CET 2007


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:
> 
> $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][]= 
> 
> 'EXT:bnews_ondemandvideo/class.bnews_ondemandvideo_tcemain_processdatamap.php:bnews_ondemandvideo_tcemain_processdatamap'; 
> 
> 
> 
> then I have the file 
> 'class.bnews_ondemandvideo_tcemain_processdatamap.php' with this inside.
> 
> <?php
> class 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, "logged | $status | $table");
>   fclose($fh);
>  }
> }
> ?>
> 
> 
> At this point I just have a simple write to a log file to see if the 
> function is getting called. Nothing gets written and there are no errors 
> in the logs. First, is there some big thing I am missing like "you have 
> to add X to file Z" or are there any tips on how to debug this stuff?

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

-- 
Dmitry Dulepov

Web: http://typo3bloke.net/
Skype: callto:liels_bugs

"It is our choices, that show what we truly are,
far more than our abilities." (A.P.W.B.D.)




More information about the TYPO3-dev mailing list