Sources for file plugins/smarty/modifier.count_paragraphs.php in version 2.0



Click on a comment to hide it. Click here to show all comments.

/*
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:     modifier
 * Name:     count_paragraphs
 * Purpose:  count the number of paragraphs in a text
 * -------------------------------------------------------------
 */
function smarty_modifier_count_paragraphs($string)
{
    
// count \r or \n characters
    
return count(preg_split('/[\r\n]+/'$string));
}

/* vim: set expandtab: */

?>


Website is Copyright © Odynia.org 2000-2005 - Xnyo is released under a BSD license.