PHP Classes

File: htdocs/xoops_lib/vendor/smarty/smarty/docs/designers/language-modifiers/language-modifier-count-sentences.md

Recommend this page to a friend!
  Packages of Michael Beck   Xoops 2.5   htdocs/xoops_lib/vendor/smarty/smarty/docs/designers/language-modifiers/language-modifier-count-sentences.md   Download  
File: htdocs/xoops_lib/vendor/smarty/smarty/docs/designers/language-modifiers/language-modifier-count-sentences.md
Role: Example script
Content type: text/markdown
Description: Example script
Class: Xoops 2.5
Modular content management publication system
Author: By
Last change:
Date: 2 months ago
Size: 811 bytes
 

Contents

Class file image Download

count_sentences

This is used to count the number of sentences in a variable. A sentence being delimited by a dot, question- or exclamation-mark (.?!).

Basic usage

{$myVar|count_sentences}

Examples

<?php

    $smarty->assign('articleTitle',
                     'Two Soviet Ships Collide - One Dies.
                     Enraged Cow Injures Farmer with Axe.'
                     );

Where template is:

    {$articleTitle}
    {$articleTitle|count_sentences}

Will output:

    Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe.
    2
   

See also count_characters, count_paragraphs and count_words.