Skip to content

Kirby 4.4.1

Str::excerpt()

Creates an excerpt of a string It removes all html tags first and then cuts the string according to the specified number of chars.

Str::excerpt(string $string, int $chars = 140, bool $strip = true, string $rep = ' …'): string

Parameters

Name Type Default Description
$string * string The string to be shortened
$chars int 140 The final number of characters the string should have
$strip bool true True: remove the HTML tags from the string first
$rep string ' …' The element, which should be added if the string is too long. Ellipsis is the default.

Return type

string

Parent class

Kirby\Toolkit\Str