RE: [PHP] Limit output of query field
| From: | Giz | Date: | Sat, 05 Jul 2003 23:33:31 +0000 |
| Subject: | RE: [PHP] Limit output of query field | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-154086@lists.php.net to get a copy of this message | ||
This add a bit more functionality, in that it will adjust to the nearest end
of a word, and includes a 'more' link to the full text. This also assumes
that the article may already only be 50 chars or less.
$maxsize = 50; // might be better as a DEFINE
$post = $row->text;
$post = (strlen($post) > $maxsize ) ? substr(substr($post,0,$maxsize-1), 0,
strrpos(substr($post,0,$maxsize-1),' '))."...<a
href='your_url_to_full_text'> more</a>" : $post;
-----Original Message-----
From: fkeessen@planet.nl [mailto:fkeessen@planet.nl]
Sent: Saturday, July 05, 2003 6:59 AM
To: php-general@lists.php.net
Subject: [PHP] Limit output of query field
Hi there,
Hope you can help me with the following:
I have a query and i'm showing the output:
echo $row->text;
That goes o.k. but the text is 400 characters long and I only one to show
the first 50 characters and at the end showing ... dot's..
Help!
Thank you very much!
Frank