Hoi Henjo,
Het volgende plaats je in ext_localconf.php:
if (TYPO3_MODE != 'BE') {
require_once( t3lib_extMgm::extPath('nc_cnvtestpiw') .
'class.kopbsurveyext.php');
}
// Add Hooks
$TYPO3_CONF_VARS['EXTCONF']['pbsurvey']['tx_pbsurvey_pi1']['processHookItem'][]
= 'tx_kopbsurveyext';
TYPO3 weet namelijk al waar dat hij deze class kan vinden. Dat was het
probleem.
Patrick
Henjo Hoeksma wrote:
> Hi list,
>
> hooks is niet mijn favo dingetje - op de e.e.a. heb ik daar nogal moeite
> mee om helder te krijgen hoe het werkt (en ja - ik lees de docu's ) ;-)
>
> Ik wil een hook gebruiken bij pbsurvey en heb de volgende code gebruikt,
> met alleen foutmeldingen als "Call to a member function
> hookItemProcessor() on a non-object"
>
> Code:
> The hook (from pbsurvey)
> ###
> function callHook($arrItem) {
> if
> (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey][$this->prefixId]['processHookItem']))
> {
>
> foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey][$this->prefixId]['processHookItem']
> as $_classRef) {
> $_procObj = & t3lib_div::getUserObj($_classRef);
> $strOutput = $_procObj->hookItemProcessor($arrItem, $this);
> }
> return $strOutput;
> }
> }
> ###
>
> My class (license stripped) class.kopbsurveyext.php
> ###
> <?php
>
> class tx_kopbsurveyext {
>
> function hookItemProcessor($arrItem,&$pObj) {
> $content = "test";
> return $content;
> }
>
> }
>
> ?>
> ###
>
> My ext_localconf.php
> ###
> <?php
>
> if (!defined ("TYPO3_MODE")) die ("Access denied.");
>
> if(TYPO3_MODE != 'BE') {
>
> require_once(t3lib_extMgm::extPath('kopbsurveyext').'class.kopbsurveyext.php');
>
> }
>
>
> $TYPO3_CONF_VARS['EXTCONF']['pbsurvey']['tx_pbsurvey_pi1']['processHookItem'][]
>
> =
> 'EXT:kopbsurveyext/class.kopbsurveyext.php:tx_kopbsurveyext';
>
> ?>
> ###
>
> Tips zijn gewenst - bij voorbaat dank!
>