Closed (won't fix)
Project:
FeedAPI
Version:
5.x-1.5
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
8 May 2009 at 04:07 UTC
Updated:
8 May 2009 at 13:09 UTC
So I am using the lightweight node items which go into the news aggregator link. It works find but for every entry the full blog post is shown. Is there any way to trim down the number of characters for each one?
Comments
Comment #1
archi commentedHi,
Try this link
http://in2.php.net/trim
Comment #2
nsummy commentedThanks. This functionality is not built in? I guess I am asking can I accomplish this without hacking the code?
Comment #3
mkinnan commentedYou can use Computed Field (http://drupal.org/project/computed_field).
Once you have that, create a new CCK field with the type being 'computed'. During the creation of the CCK field, you will see a text box for 'computed code'. Paste the following:
$string = $node->body;
$output = truncate_utf8($string, 265, $wordsafe = FALSE, $dots = TRUE);
$node_field[0]['value'] = $output;
Now, that CCK field will have a snippet (first 265 characters) of the entire post. You will have to make modifications to your node.tpl.php file in order to display the computed field instead of the node body.
This worked for me on Drupal 6, but it might still work on Drupal 5.
Comment #4
alex_b commentedThis functionality is not built in and there are no plans to add it as this module is discontinued.