never mind i worked it out

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;
                }
        }
explodes and splits were not getting the "." properly
>===== Original Message From daniel <[EMAIL PROTECTED]> =====
>hi there , i am trying to show news content , the page may get pretty huge if
>they all show on the same page , i have been considering a caption of 255
>chars max , i would like to know if i could prob limit the front to 255 chars
>and if its between a word somehow show it till the last . probably meaning 
the
>end of the sentence ? this could be a better option then show a more link for
>it ??
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to