It bugs me sometimes that Drupal will just cut at a part in your node, without letting the user know something has been cut. So... here is what I did to fix that...
Open up node.module in your favorite editor and search for 'function node_teaser($body)'.
You should see some sections that look like this:

return substr($body, 0, $delimiter);

Replace all of them with something like this:

$retval = substr($body, 0, $delimiter);
$retval=  "$retval... <i>Read on...</i>";  // Change this to whatever make you feel cozy
return $retval;

Thoughts? Suggestions? Flames?

Comments

nazadus’s picture

Sorry, forgot the add the angeled brackets, no wonder it looks weird:

    $retval = substr($body, 0, $delimiter);
    $retval=  "$retval... &lt;i&gt;Read on...&lt;/i&gt;";
    return $retval;

-----------------
"Our greatest glory is not in never failing but in rising every time we fall." -- Confusious

Adam’s picture

This might fit better in the theme itself. I added this after the node->body is added to $output:

if ($main && (strlen(trim($node->teaser)) < strlen(trim($node->body)))) {
    $output .= "<div class=\"readmore\">" . l("Read the rest of <em>$node->title</em>", "node/view/$node->nid") . "</div>\n";
  }

I needed to compare the lengths of the trimmed bits, since some of my imported posts had some strange bits added that made the teaser and body not exactly the same even when they were. You may not need it.

Anyways, I think this fits a little nicer than in node.module, since you can do all the CSS fiddling you want. But I'm sure there are plenty of other ways to do it.

therobots.org - Are we not robots?

nazadus’s picture

Excellent idea! I didn't know you could do that.

-----------------
"Our greatest glory is not in never failing but in rising every time we fall." -- Confusious

nazadus’s picture

Since I used a hacked up version I had to do things a wee-bit different.
I had to place this:

  if ($main && (strlen(trim($node-&gt;teaser)) &lt; strlen(trim($node-&gt;body)))) {
    $node-&gt;teaser .="&lt;div class=\"readmore\"&gt;" . l("Read on...", "node/view/$node-&gt;nid") . "&lt;/div&gt;\n";
  }

right after the 'global $xtemplate' so it would adjust what is needed, since the next action is to throw them into an array and I didn't know how to extract array elements (It's been a while since I've done serious PHP).

However, I like your idea much better than mine, about throwing it in the theme verus hacking a core module (think: Future upgrades).

nazadus’s picture

I don't know if it's blindingly obvious where this should go or not... but it belongs in the 'function etherpunk_node'.

-----------------
"Our greatest glory is not in never failing but in rising every time we fall." -- Confusious