[drupal-devel] [bug] Teaser always truncated at 600 characters
killes
drupal-devel at drupal.org
Sun Aug 21 19:49:18 UTC 2005
Issue status update for
http://drupal.org/node/28211
Post a follow up:
http://drupal.org/project/comments/add/28211
Project: Drupal
-Version: 4.6.2
+Version: cvs
Component: node.module
Category: bug reports
Priority: normal
Assigned to: Anonymous
Reported by: neale
Updated by: killes at www.drop.org
-Status: active
+Status: patch (code needs review)
changing version and status.
killes at www.drop.org
Previous comments:
------------------------------------------------------------------------
Thu, 04 Aug 2005 19:18:23 +0000 : neale
Attachment: http://drupal.org/files/issues/diff_27 (1.16 KB)
The truncation code in node_teaser doesn't make any sense to me:
<?php
foreach ($breakpoints as $point => $charnum) {
if ($length = strpos($body, $point, $size)) {
return substr($body, 0, $length + $charnum);
}
}
?>
I don't understand: why is the offset given to strpos the maximum
teaser size? This would cause teasers to only be nicely split if they
are enough longer than the max. teaser size to have one of the special
characters. But this guarantees the teaser will either be abruptly
truncated, or over the max. teaser size! In fact, this is what I'm
seeing on my installation.
Attached is a patch that makes it work the way I think it was intended.
At least, it makes more sense to me.
More information about the drupal-devel
mailing list