On 18-Jul-2001 chris schneck wrote:
> Hey all,
> was curious if anyone has had experience with limiting the amount of text
> pulled from a database and placing a link and the end of the excessive text
> line.
> ie. the description of a product could be 800 characters long, how can it be
> shortened to 50 -100 characters with a link to "read more" at the end. I was
> fiddling with strlength and an if else statement, but i cant really get
> things happenin. Any and all help would greatly be appreciated.
> 

if ( strlen($foo) > 100) {
    echo substr($foo,0,100), ' <A HREF="/showmore.php">More ...</A>';
} else {
    echo $foo;
}

> Regards
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to