<HTML ><HEAD ><TITLE >count_sentences</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Smarty Manual" HREF="index.html"><LINK REL="UP" TITLE="Variable Modifiers" HREF="language.modifiers.html"><LINK REL="PREVIOUS" TITLE="count_paragraphs" HREF="language.modifier.count.paragraphs.html"><LINK REL="NEXT" TITLE="count_words" HREF="language.modifier.count.words.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="sect1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Smarty Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="language.modifier.count.paragraphs.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 5. Variable Modifiers</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="language.modifier.count.words.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="language.modifier.count.sentences" ></A >count_sentences</H1 ><P > This is used to count the number of sentences in a variable. </P ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN716" ></A ><P ><B >Example 5-6. count_sentences</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /><br />$smarty</span><span style="color: #007700">-></span><span style="color: #0000BB">assign</span><span style="color: #007700">(</span><span style="color: #DD0000">'articleTitle'</span><span style="color: #007700">,<br /> </span><span style="color: #DD0000">'Two Soviet Ships Collide - One Dies.<br /> Enraged Cow Injures Farmer with Axe.'<br /> </span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?></span> </span> </code></TD ></TR ></TABLE ><P > Where template is: </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="programlisting" >{$articleTitle} {$articleTitle|count_sentences}</PRE ></TD ></TR ></TABLE ><P > Will output: </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe. 2</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ><P > See also <A HREF="language.modifier.count.characters.html" ><TT CLASS="varname" >count_characters</TT ></A >, <A HREF="language.modifier.count.paragraphs.html" ><TT CLASS="varname" >count_paragraphs</TT ></A > and <A HREF="language.modifier.count.words.html" ><TT CLASS="varname" >count_words</TT ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="language.modifier.count.paragraphs.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="language.modifier.count.words.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >count_paragraphs</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="language.modifiers.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >count_words</TD ></TR ></TABLE ></DIV ></BODY ></HTML >