Re: retrieving first paragraph

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi!

afaik limiting the query may get quite complicated, using those
string-operators. in php just do it this way:

    // depending on your $excerpt you have to use \n\n or only \n
    $paragraphs = preg_split('#([^\n]+)(\n\n)#mi', $excerpt);
    echo $paragraphs[0]; // contains first paragraph

hope this works.

.ma

Lisi <lists@shemeshdirectory.co.il> wrote@26.05.2003 12:07 Uhr:

> I have a table column that stores a few paragraphs of text. I want a
> preview page that retrieves the first paragraph, and then links to the full
> text on another page.
> 
> 1) Can I limit this in the MySQL query?
> 
> 2) If not, how would I select all text up until the first \n? I so far have
> 
>   ereg("(.){1,}\n", $text, $excerpt);
> 
> I want the parentheses to capture the text up until the \n in the variable
> $excerpt, and then stop there.
> 
> How do I do this with ereg?
> 
> Thanks,
> 
> -Lisi
> 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux