RE: [PHP] limiting text output
| From: | Don Read | Date: | Wed, 18 Jul 2001 19:48:34 +0000 |
| Subject: | RE: [PHP] limiting text output | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-58527@lists.php.net to get a copy of this message | ||
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: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
Don Read dread@texas.net
-- 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.