Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

nl2br

Summary

Returns the input string with all newlines converted to HTML breaks.

Usage

input|nl2br()

Returns

A string with HTML breaks.

Description

This operator takes a string as input. It replaces newline characters/sequences with HTML break tags and returns a modified version of the input.

Examples

Example 1

{'The lazy
cat
jumps over
the quick rat.'|nl2br()}

The following output will be produced:

The lazy<br />cat<br />jumps over<br />the quick rat.

Balazs Halasy (05/02/2004 10:57 am)

Julia Shymova (14/01/2008 1:00 pm)

Balazs Halasy, Julia Shymova


Comments

  • example

    break() is an alias for nl2br()? Anyway, the example should deal with the current operator nl2br().
    • Re: example

      break() is completely equal to nl2br() operator.
      The example is now fixed. Thanks for pointing this out.