RE: [PHP-WIN] REGEX? SQL? Getting only so much from a long fiel d
| From: | Asendorf, John | Date: | Tue, 17 Oct 2000 12:45:42 +0000 |
| Subject: | RE: [PHP-WIN] REGEX? SQL? Getting only so much from a long fiel d | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-3291@lists.php.net to get a copy of this message | ||
This is what I decided to do. Seems to work OK.
if (!$short){
echo "<P>$place - $story</P>\n";
}
else {
$story = split ("<br>", $story, 2);
echo "<P>$place - ${story[0]} <a
href=\"${full_story_page}?story_key=$key\">Read more...</a></P>\n";
}
Whadaya think?
---------------------
John Asendorf - jasendorf@lcounty.com
Web Applications Developer
http://www.lcounty.com - NEW FEATURES ADDED DAILY!
Licking County, Ohio, USA
740-349-3631
> -----Original Message-----
> From: Pablo Vera [mailto:pvz@vercan.com]
> Sent: Monday, October 16, 2000 5:54 PM
> To: Php-Windows
> Subject: Re: [PHP-WIN] REGEX? SQL? Getting only so much from a long
> field
>
>
> John:
>
> You can try the following (I have never used them, but...):
>
> 1. Get the position of the first <BR> using strpos():
> $pos = strpos($longstory,"<BR>");
>
> 2. Extract the first part using substr():
> $preview = substr($longstory,1,$pos-1);
>
> 3. Show the preview:
> echo $preview;
>
> You can check these functions in the PHP manual under String
> Functions.
>
> I hope this helps.
>
> Saludos,
> Pablo Vera
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>
> Monday, October 16, 2000, 2:38:21 PM, John wrote:
>
> AJ> Hello all,
>
> AJ> I've got some long stories in a news database. I want to
> make a little
> AJ> "preview" type function that only spits out the first
> paragraph and then
> AJ> says "read the rest"... what I can't figure out is how
> to have it just
> AJ> read the field up to the first <br> tag. (all of the
> stories have these
> AJ> added when the story is put into the database. Any suggestions?
>
> AJ> John
>
> AJ> ---------------------
> AJ> John Asendorf - jasendorf@lcounty.com
> AJ> Web Applications Developer
> AJ> http://www.lcounty.com - NEW FEATURES ADDED DAILY!
> AJ> Licking County, Ohio, USA
> AJ> 740-349-3631
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>