[TYPO3-core] RFC: #9602: hook in tslib_fe::contentStrReplace isn't flexible enough
Oliver Hader
oliver at typo3.org
Tue Oct 21 14:41:13 CEST 2008
Hi Steffen,
Steffen Kamper schrieb:
> this is a SVN patch request.
>
> Branches: trunk
>
> BT reference: http://bugs.typo3.org/view.php?id=9602
>
> Problem:
> The Hook in tslib_fe::contentStrReplace uses an array with $search and
> $replace which is good for simple replace like
> $params['search'][] = 'typo3';
> $params['replace'][] = 'TYPO3';
>
> For the case you want to replace more complex stuff it can't be done
> this way.
> For Example if you have a cached page and you want to output
> click-counter of items you need to search with reg. expressions, fetch
> the record and replace it with the field value.
>
> In this case it's easy to pass the content too without changing the
> count of parameters in the hook, so it's 100% backward compatible.
> Once the content is passed you have the freedom to do any complex
> operation with it.
>
> I did this with the attached patch.
The hook gets called with this:
t3lib_div::callUserFunction($_funcRef, $_params, $this);
And the hook function might look like this:
public function strReplaceHook(array &$parameters, tslib_fe
&$parentObject) {
$content =& $parentObject->content;
}
Any questions? ;)
olly
--
Oliver Hader
TYPO3 4.3 Release Manager
More information about the TYPO3-team-core
mailing list