[TYPO3-core] RFC: #9602: hook in tslib_fe::contentStrReplace isn't flexible enough

Steffen Kamper info at sk-typo3.de
Sat Oct 18 15:34:01 CEST 2008


Hi,

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.

vg Steffen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: contentStrReplaceHook.diff
Type: text/x-diff
Size: 508 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20081018/c6f949ee/attachment-0001.diff 


More information about the TYPO3-team-core mailing list