[TYPO3] Replacing a character during content rendering
Tyler Kraft
tyler.kraft at netefficiency.co.uk
Sun Mar 2 02:42:31 CET 2008
you might have also been able to use XXX.stdWrap.parseFunc.short.' = &rsquo
I've not tried this but I might work
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
More information about the TYPO3-english
mailing list