RE: [PHP] splitting text solved

2003-06-04 Thread electroteque
i found a snippet somewhere which helped me out and i modified it $value) { $keyword .= " +".$value; } } echo $keyword; ?> so basically u can have a heap of keywords with some in exact phrases within quotes and it adds the + for you to make it an AND boolean search string

Re: [PHP] splitting text after 25 words

2001-08-08 Thread jose d lopez
someting i've used. At 03:57 PM 8/8/2001 +1100, Justin French wrote: >Hi all, > >I'd like to split a text block at 25 words, as a teaser for the full >article. Now I know how to split at a certain character, but i don't >want a half word or anything, so I want (i guess) to hunt for the 25th

RE: [PHP] splitting text after 25 words

2001-08-08 Thread Robert V. Zwink
7;.', -2); -> 'mysql.com' This function is multi-byte safe. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Hope this helps! Robert V. Zwink DAID Development LLC http://www.zwink.net/daid.php -Original Message- From: Justin French [mailto:[EMAIL PROTECTED]] Sent: Wednes

Re: [PHP] splitting text after 25 words

2001-08-08 Thread Justin French
Thanks to all who replied, this solution by Chris was bar far the easiest to implement. Really appreciate it :) Chris Lambert wrote: > $teaser = explode(" ", $article, 26)); > array_pop($teaser); > $teaser = implode(" ", $teaser); Justin French -- PHP General Mailing List (http://www.php.n

Re: [PHP] splitting text after 25 words

2001-08-07 Thread karthik
Hi, Best way i guess would be traverse the whole string and check for space. Have a counter var which keeps count of the space. At the 25th occurence do something like this - $text_a = substr($text, 1, $i); i assume that $i is the increment var in the loop. $text_b = substr($text, $i+1); This

Re: [PHP] splitting text after 25 words

2001-08-07 Thread Chris Lambert
$teaser = explode(" ", $article, 26)); array_pop($teaser); $teaser = implode(" ", $teaser); /* Chris Lambert, CTO - [EMAIL PROTECTED] WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */ - Original Message - From: Justin French <[EMAIL PROTECTED]>

RE: [PHP] Splitting Text

2001-08-07 Thread Robert V. Zwink
For future reference using explode and counting the words is not the correct way to do this. Your array could be huge, and if you have multiple requests to the page this would be a horrible idea. I believe the correct way to do this is to use MySQL inherent function SUBSTRING_INDEX(str,delim,cou

Re: [PHP] Splitting Text

2001-08-07 Thread Jordan Elver
Thanks for that. I ended up using your method as using the LEFT function in a SELECT only grabs characters. Cheers, Jord On Monday 06 August 2001 17:37, you wrote: > You can do this several ways... Either use explode(): > http://www.php.net/manual/en/function.explode.php > > ...to split the re

RE: [PHP] Splitting Text

2001-08-06 Thread Matthew Loff
You can do this several ways... Either use explode(): http://www.php.net/manual/en/function.explode.php ...to split the retrieved data by a space " " as the delimeter, then use a for() loop to print X number of words... E.g.: $array = explode(" ", $db_string); for($i = 0; $i < 25; $i++)

RE: [PHP] Splitting Text

2001-08-06 Thread Alfredeen, Johan
Jord, I would accomplish this through SQL. You could use SELECT LEFT(mycolumn,x) FROM mytable WHERE ... and then display that along with a link to a page where you select the whole string on that particular article ID. In fact, I do this exact thing on my site. Or you could read the whole strin