Hey all,
I would like to query the database and if the result comes back with multilple sentences I would like to take the paragraph and strip everything except the first sentence. I'm sure there is a tag out there to do so. I looked through the manual and couldn't come up with much.
Thanks for the help
Stripping paragraphs
Moderator: General Moderators
you could use explode to pick out the first sentence.
but there's no sure shot at cutting out a sentence. if something is abbr. then the sentence gets cut off at the ".".
Code: Select all
<?
$text = "blah blah blah. words words words.";
$break = explode(".",$text);
echo "$breakї1].";
?>Code: Select all
<?
$text = "blah blah blah. words words words.";
$break = explode(".",$text);
echo "$breakї0].";
?>yes, but remember - if there's anything in that sentence that has a period in it, you're screwed...
for example; "I'm not quite sure that http://www.phpdn.com is cool enough."
Your example there would have a hayday with that one
-enygma
for example; "I'm not quite sure that http://www.phpdn.com is cool enough."
Your example there would have a hayday with that one
-enygma
Yup, I have used :
for a scrolling marquee.
This isn't a perfect answer because it may cut a sentence short or may run into the next sentence, but it worked for my purposes.
Code: Select all
$text = (substr($body,0,50));
<marquee "attributes"><a href = "url">$text...Click here for full details</a></marquee>This isn't a perfect answer because it may cut a sentence short or may run into the next sentence, but it worked for my purposes.