Closed (fixed)
Project:
Read More Link (Drupal 6 and earlier)
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
12 Aug 2008 at 09:04 UTC
Updated:
26 Apr 2009 at 19:20 UTC
I've setup a custom CCK type for Header Image module, which only display one image on teaser.
The current code has "readmore" link even if $node->body is empty.
The following line fix it.
Change:
if ($teaser && $node->readmore) {
to
if ($teaser && $node->readmore && !empty($node->body)) {
PS: I wonder if there's any implication if it is done this way..
Comments
Comment #1
todd nienkerk commentedThe same fix may apply to 6.x-3.x-dev. Will investigate.
Comment #2
todd nienkerk commentedI used a different method to ensure
$node->bodyisn't empty. Because it's also worthwhile to ensure the teaser contains fewer characters than the body -- if they're equal, the teaser is actually displaying the full node -- I've added some logic that will handle both concerns at once:The important piece is:
If the body is empty, its length equals 0; the teaser cannot possibly have fewer than 0 chars. That statement will return FALSE if
$node->bodyis empty.I have committed this to the 6.x-3.x-dev branch.
Comment #3
todd nienkerk commentedComment #4
todd nienkerk commentedTurns out the method I used to check for this is flawed due to some problems with hook_nodeapi's operations ($op) path. I am changing this issue to "needs work."
FYI: I am switching from the hook_nodeapi() to template_preprocess_node() method of appending the link to the end of the node teaser.
Comment #5
todd nienkerk commentedTested recent changes. I didn't get any "read more" links for blank nodes.