The 'read more' link is always displayed, even if all of the content of the node is revealed.
A patch is attached.
Summary: If the length of $node->teaser is equal to or larger than the teaser_size variable, assume that there is more to the article not shown and display the read more link.
I know this isn't perfect because drupal doesn't hard limit the length so if the actual article length is close to the teaser size (within a word), there could be a read more link even though the whole article is shown.
*shrug* this has been an issue for atleast nine months (http://drupal.org/node/26409), figured something that works 99% of the time would be fine, even though it is a quick fix :p
Comments
Comment #1
bullerk commentedforgot to set the status to patch ^^;
Comment #2
Marco Palmero commentedyes this was a frustrating thing about flexinode, thanks
Comment #3
Bèr Kessels commentedThis is not the correct way, sorry. This will introduce fuzzyness. the readmore will often appear when it should not and often not, when it should. Then having it always show up is a better solution.
Comment #4
samc commentedThere are two situations in which the Read More link should be displayed:
1) There are fields where (teaser content != body content)
2) There are fields that are not displayed in the teaser
The attached patch implements this logic.
Unless I'm missing something, this should work 100% of the time ;-)
Comment #5
Bèr Kessels commentedYour logic seems strange:
You are saying: if there is no $body_data AND body_data is empty, set the readmore TRUE....
please explain this, in detail. I fear I missed something. Else set status to "code needs work".
Comment #6
samc commentedThanks for reviewing.
I think the patch got misapplied somehow in what you are looking at. The else in your snippet goes with the if ($field->show_teaser).
This is the resulting code, but massaged a bit for readability:
The outer if just checks for valid content. If there is content, it is appended to the node's body.
Then we look at whether the field is to be displayed in the teaser.
If it is, and the body contains more (i.e. different) stuff than the teaser itself, we want to set READMORE.
If it isn't, then we know we want to set READMORE.
Does this help?
Comment #7
samc commentedNote, alignment got messed up in first if above.
This is the actual resulting code that should be produced by the patch:
Comment #8
Bèr Kessels commentedany chance of making this a real patch?
Comment #9
samc commentedIs there something wrong with the one that's attached in #4?
http://drupal.org/node/58202#comment-92140
Comment #10
samc commentedRerolled patch against CVS.
Comment #11
samc commentedfixed problem w/ generating body
Comment #12
Bèr Kessels commentedCommitted. thanks all!
Comment #13
(not verified) commented