Request for increased functionality: drupalicious_summarise

The drupalicious_summarise function works great. Thank you very much for the contribution.

I've searched and found a method to supply a "...continue reading..." string by performing a test on str_word_count but I was hoping someone could suggest the same functionality directly within the original drupalicious_summarise function. I've tried many times and failed. The output of the drupalicious_summarise routine always results in a sentence that ends with a period. Surely there must be a way to append a second string (perhaps a variable) so that after the period would appear something like this, "......this is the end of the sentence. [..continued..]" directly within the drupalicious_summarise function.

Thank you in advance,
MOTE

EDIT:
I FINALLY figured it out! Here's the mod:

function drupalicious_summarise($paragraph, $limit)
{
$extra = "  [..continued..]";
$textfield = strtok($paragraph, " ");
while($textfield)
      {
           $text .= " $textfield";
           $words++;
           if(($words >= $limit) && ((substr($textfield, -1) == "!")||(substr($textfield, -1) == ".")))
               break;
           $textfield = strtok(" ");
      }
          if (str_word_count($text) >= $limit) $text = $text . $extra;
       return ltrim($text);
    }

Thanks for making me think! :-)

MOTE

How to add link to the ..continued text

geshan - May 23, 2008 - 03:14

I assume it will just show ...continued... with no link to that node. How do we add the link????

Geshan

Basic Drupal HOw to

 
 

Drupal is a registered trademark of Dries Buytaert.