[TYPO3-mvc] new feature proposal: f:format.crop returns whole if set to 0

Peter Niederlag typo3-list at niekom.de
Mon Mar 7 12:58:03 CET 2011


Hi,

99999 should probably do the trick in mosts cases as well.

I am fine with implementing '0' as "disable crop".

Greets,
Peter

Am 06.03.2011 16:48, schrieb Stefano Cecere:
>
> hi,
> i see that the .crop function hasn't an option to NOT crop
>
> i often need to set it to "NOT CROP" anything, without major changes in
> TS, or Fluid templates.
>
> i could easily get this option, for example if the crop value is set to
> 0, modifying file
> ~/Sites/typo3_src-4.5.2/typo3/sysext/fluid/Classes/ViewHelpers/Format/CropViewHelper.php
>
> with a simple condition:
>
> if ( $maxCharacters > 0 ) {
> if ($respectHtml) {
> $content = $this->contentObject->cropHTML($stringToTruncate,
> $maxCharacters . '|' . $append . '|' . $respectWordBoundaries);
> } else {
> $content = $this->contentObject->crop($stringToTruncate, $maxCharacters
> . '|' . $append . '|' . $respectWordBoundaries);
> }
> } else {
> $content = $stringToTruncate;
> }
>
>
>
>
> in this way, for example in a fluid tempalte with
> <f:format.crop maxCharacters="{settings.cropLength}"
> respectWordBoundaries="true">{newsItem.bodytext}</f:format.crop>
>
> we just need to set settings.cropLength = 0, and you got the full bodytext
>
>
> what do you think?
>


-- 
Peter Niederlag
http://www.niekom.de * TYPO3 & EDV Dienstleistungen *


More information about the TYPO3-project-typo3v4mvc mailing list