Issue Feature Rejected

#31969cropHTML, dynamic max number of chars

Daniel Mannheimer 11/21/11, 22:20 updated 06/14/24, 20:34

Description

It would be nice if cropHTML (and crop) could handle variables as first parameter inside $options. Would take just one additional line of code in root/typo3/sysext/cms/tslib/class.tslib_content.php:

    function cropHTML($content, $options) {
        $options = explode('|', $options);
        // added next line to process $options[0] with insertData and so be able to use variables for cropping length
        $options[0] = $this->insertData($options[0]);        
        $chars = intval($options[0]);

So one could use constants or register values to pass to cropHTML like
tt_content.text.20.cropHTML = {$contentCropLength} | … | 1
tt_content.text.20.insertData = 1
or
tt_content.text.20.cropHTML = {register:croplength} | … | 1
tt_content.text.20.insertData = 1

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 11

  1. Mathias Schreiber commented and changed category status New Accepted target version PHP Version 5.5 12/04/14, 17:04

    Might need some additional testing if the value transmitted s a variable but apart from that… nice addition

  2. Mathias Schreiber changed target version 12/23/14, 19:46

  3. Benni Mack changed target version 06/15/15, 17:44

  4. Susanne Moog changed target version 08/05/15, 10:31

  5. Benni Mack changed target version 09/24/15, 20:35

  6. Riccardo De Contardi changed target version 02/23/17, 14:55

  7. Susanne Moog changed target version 01/28/18, 14:52

  8. Susanne Moog changed target version 09/06/18, 14:07

  9. Susanne Moog changed Sprint Focus On Location Sprint 08/05/22, 13:22

  10. Oliver Hader changed Sprint Focus On Location Sprint 11/03/22, 09:04

  11. Benni Mack commented and changed status Accepted Rejected 06/14/24, 20:34

    Hi Daniel,

    unfortunately, as statistics show us — people don’t use TypoScript for more sophisticated parts anymore – either they use custom data processors, or they just a Fluid ViewHelper. I recommend doing this as well, as – after all these years – looks like we don’t find anymore adding this feature and find a valid use-case (nowadays) for it.

    I hope this is OK for you! Sorry for keeping you waiting for so long.