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

archi’s picture

Hi,

Try this link
http://in2.php.net/trim

nsummy’s picture

Thanks. This functionality is not built in? I guess I am asking can I accomplish this without hacking the code?

mkinnan’s picture

You 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.

alex_b’s picture

Priority: Critical » Normal
Status: Active » Closed (won't fix)

This functionality is not built in and there are no plans to add it as this module is discontinued.