$node->readmore always true because it compares filtered teaser with unfiltered body.

bangpound - March 19, 2008 - 16:19
Project:Excerpt
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I have a node where the teaser and body are the same. A "read more" link is not desirable in this circumstance.

This is happening because the teaser is filtered but the body is not. See this dpm output for the case:

teaser: <p>The world is full of bullies and frauds.</p>
body: The world is full of bullies and frauds.

In my previous patch at #235382, I made the comparison at $op = 'load' and it worked fine, but looking at that a little more closely, it was just allowing the normal node_view calculation for the readmore property to rule. If the teaser were longer than the body, you'd not see the read more link.

This patch fixes it by calculating readmore on load and storing the boolean in a static variable for the excerpt_nodeapi function. Then in view, it overwrites the readmore property with the stored value.

AttachmentSize
excerpt-readmore.patch1.23 KB

#1

smk-ka - March 20, 2008 - 00:53
Status:active» patch (code needs review)

I'm not sure if nodeapi is always called in this set order, ie. if nodes are always loaded and immediately viewed thereafter, with no other node load inbetween. Let's play safe and store the readmore status in a node property, which we copy over on "view".

AttachmentSize
excerpt.module.patch1013 bytes

#2

smk-ka - March 20, 2008 - 02:06

Revised patch adding support for nodes that were saved with earlier versions of excerpt (when teasers were still generated on load). I know it's a bit offtopic, however you seem to be interested in getting out a stable release of this module, so I just put it here.

AttachmentSize
excerpt.module.patch1.36 KB

#3

smk-ka - March 27, 2008 - 11:37
Status:patch (code needs review)» fixed

This has been committed.

#4

Anonymous (not verified) - April 10, 2008 - 11:41
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.