aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/smarty/smarty/docs/designers/language-modifiers/language-modifier-count-paragraphs.md
blob: 02c474e6b83419a89cd13bf6cdbbb6b159673c52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
count\_paragraphs {#language.modifier.count.paragraphs}
=================

This is used to count the number of paragraphs in a variable.


    <?php

    $smarty->assign('articleTitle',
                     "War Dims Hope for Peace. Child's Death Ruins Couple's Holiday.\n\n
                     Man is Fatally Slain. Death Causes Loneliness, Feeling of Isolation."
                    );

    ?>

       

Where template is:


    {$articleTitle}
    {$articleTitle|count_paragraphs}

       

Will output:


    War Dims Hope for Peace. Child's Death Ruins Couple's Holiday.

    Man is Fatally Slain. Death Causes Loneliness, Feeling of Isolation.
    2

       

See also [`count_characters`](#language.modifier.count.characters),
[`count_sentences`](#language.modifier.count.sentences) and
[`count_words`](#language.modifier.count.words).