View/Helper/Truncate.php
- Classes
- Kwf_View_Helper_Truncate
\Kwf_View_Helper_Truncate
Description
Borrowed from smarty and extended
Methods
truncate
truncate(
          string|array $string, integer $length
              =
              80, string $etc
              =
              …, boolean $break_words
              =
              false, boolean $middle
              =
              false
          )
        
        :
        stringThe truncate method itself.
Arguments
- $string
- stringarray
 The Input to be truncated (string) The string to be truncated (array) An array of strings to be truncated. Can be one of the following: array('String text 1', ' - String text 2') -- or -- array( array('string' => 'String text 1'), array('string' => ': String text 2', 'tag' => 'span'), array('string' => ' - String text 3', 'tag' => 'strong', 'cssClass' => 'thirdPart') )
- $length
- integer
 The maximum string length that should be returned. Default: 80
- $etc
- string
 The extension of the string if (and only if!) it has been cut. Default: '…' (…)
- $break_words
- boolean
 Wether to break within words or not. Default: false
- $middle
- boolean
 Truncates the string in the middle, not at the end. Not possible if the first argument is an array. Default: false
Output
- string
- $string The truncated string, or the original string if it's shorter than $length.
 Details
 Details
- visibility
- public
- final
- false
- static
- false
- todo
- Possibility to put ready html into $string and act the way like it would be an array
