dynamically splitting a paragraph for a preview of content

From: Date: Thu, 20 Mar 2003 02:27:37 +0000
Subject: dynamically splitting a paragraph for a preview of content
Groups: php.general 
Request: Send a blank email to php-general+get-140382@lists.php.net to get a copy of this message
hi guys , i assumed i had this working but i stand corrected, it basically will get the first dot in content which should denote a end of paragraph and show that as a preview, although say i put g.w bush in it will split off there which i dont want , is there a way i can do this with a paragraph that may look like this rweqijr riopjwrpioqwrj pqwrojrqwiopj rqwpjwrio oqrwqwriojwqijwroij. iojwrqioj where the dot and space should denote a paragraph or rweqijr riopjwrpioqwrj pqwrojrqwiopj rqwpjwrio oqrwqwriojwqijwroij ojwrqioj. wejkqwqwpokwrop rqpokqwopr poqwrkp oqwrkw where the newline should denote a pagraph, let me know thanks. function create_caption($content,$max_length,$primaryID,$ID) { if (strlen($content) > $max_length) { $paragraph_i="."; $position=strpos($content,$paragraph_i); if (is_integer($position)) { $preview=substr($content,0,$position); $preview.=" [ <a href=\"".$GLOBAL['PHP_SELF']."?".$primaryID."=".$ID."\"> More </a>]"; return $preview; } } else { return $content; } }

« previous php.general (#140382) next »