By nazadus on
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
Sorry, forgot the add the ang
Sorry, forgot the add the angeled brackets, no wonder it looks weird:
-----------------
"Our greatest glory is not in never failing but in rising every time we fall." -- Confusious
In the theme?
This might fit better in the theme itself. I added this after the node->body is added to $output:
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?
Excellent idea! I didn't know
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
FYI
Since I used a hacked up version I had to do things a wee-bit different.
I had to place this:
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).
Forgot to add what function
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