[TYPO3] Replacing a character during content rendering

Xavier Perseguers typo3 at perseguers.ch
Sun Mar 2 09:16:37 CET 2008


Hello,

> you might have also been able to use XXX.stdWrap.parseFunc.short.' = &rsquo
> 
> I've not tried this but I might work

I did not know of this function but it's really handful. Thanks. The 
problem is that "'" is not a string and thus is not taken into account. 
I'll do more investigations in this direction.

Xavier




> Xavier Perseguers wrote:
>>> I would like to replace all straight apostrophes (') with the ’ 
>>> character in all my text and text w/image blocks. The reason is that 
>>> the straight apostrophe is not good in a typesetting context.
>> I found a better way but it still isn't as fine as I wished.
>>
>> As I use TemplaVoila, I edited the DS to read:
>>
>> -- cut ---------------------
>> 10= RECORDS
>> 10.stdWrap.postUserFunc = user_parseFunc->replaceApostrophes
>> -- cut ---------------------
>>
>> and I created a file class.user_parseFunc.inc:
>>
>> -- cut ---------------------
>> <?php
>> class user_parseFunc {
>>         function replaceApostrophes($content, $conf) {
>>                 return str_replace("'", '’', $content);
>>         }
>> }
>> ?>
>> -- cut ---------------------
>>
>> The problem is that this method is called for the whole page content, 
>> not for every content element. That is, I cannot bypass the str_replace 
>> function for content block whose type is not "text" or "text w/ images". 
>> As such, I get my apostrophes being replaces everywhere, that's a bit 
>> too much.
>>
>> There seems to be a possible hook in 
>> typo3/sysext/cms/tslib/class.tslib_content.php, function stdWrap, 
>> configuratoin "postUserFunc". But 1) I don't know if it is the place to 
>> hook and 2) I cannot find a way to hook there actually.
>>
>> Any help?
>>
>> Xavier Perseguers
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english



More information about the TYPO3-english mailing list