[TYPO3-dev] Plugin Counter: How often a plugin was inserted on a page

Francois Suter fsuter at cobweb.ch
Mon Jun 22 14:12:35 CEST 2009


Hi,

>> $GLOBALS['TSFE']->register['myplugin'][] = $this->cObj['data]['uid'];
> 
> Fatal error: Cannot use object of type tslib_cObj as array in 
> [aLongPath]/tx_sfslideshow_pi1.php

Yes, the code is wrong (in 2 places). It should be:

$GLOBALS['TSFE']->register['myplugin'] = $this->cObj->data['uid'];

I read your response to my other post in this thread and if I understand
well, all you need is a unique identifier for your plugin. The above
code can help, but the uid will not be available if the plugin is
inserted using TypoScript. What you can do is use a register, as
mentioned above, but increase it each time, such as:

$GLOBALS['TSFE']->register['myplugin'] =
$GLOBALS['TSFE']->register['myplugin']++;

Then again you could use a static class variable as I mentioned before.

HTH

-- 

Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch




More information about the TYPO3-dev mailing list