Skip to main content
Participating Frequently
February 16, 2007
Question

Display a few sentences then having ...read more

  • February 16, 2007
  • 2 replies
  • 266 views
DW8/PHP/MySQL

I am wanting to know how I can have only the first two or the sentences display out of a multi paragram description followed by ...read more
This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

Inspiring
February 18, 2007
David Powers wrote:

> newhorizonhosting.com wrote:
>
>> DW8/PHP/MySQL
>>
>> I am wanting to know how I can have only the first two or the
>> sentences display out of a multi paragram description followed by
>> ...read more
>
>
> Computer languages don't understand the concept of a sentence, so you
> need to build a function to do it for you. The technique is explained in
> detail in Chapter 11 of my book "Foundation PHP for Dreamweaver 8".
>

The "read more" requirement would suggest a client side solution.

[javascript]
var NumberOfSentences=3,
str="blah blah",
Long= str.replace(/[\n\r]/g,"").split(/\. /);
var Short=S.slice(0,NumberOfSentences).join(". ");

Untested.
Mick
Mick

Inspiring
February 16, 2007
newhorizonhosting.com wrote:
> DW8/PHP/MySQL
>
> I am wanting to know how I can have only the first two or the sentences display out of a multi paragram description followed by ...read more

Computer languages don't understand the concept of a sentence, so you
need to build a function to do it for you. The technique is explained in
detail in Chapter 11 of my book "Foundation PHP for Dreamweaver 8".

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/