This patch fixes three problems in revision 1.4:
1) If you edit a post, the automatically generated excerpt does not update with your changes. To fix this, the 'form post' code now checks to see whether the teaser is a custom one or not. If it was automatically generated one, the code makes the Excerpt form field empty so it will get re-generated when you preview or submit your edits.
2) There is no way to specify that you want no excerpt/teaser at all. Rather than add a checkbox or the like, I simply removed the trim() call in the 'validate' code. This now allows you to enter a space character to signify "no excerpt", and I changed the help text to note this.
3) The calculation of $node->readmore in the 'view' code did not take into account the fact that node_prepare() is called first, so either the teaser or the body has already had check_output() run on it. This resulted in "read more" links when they were not needed. The code now corrects for this before comparing the teaser and body.
I'm using the excerpt module with Drupal 4.5.2 in a team website at work, and with these changes it is now working very smoothly.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | geary-2005-09-15.excerpt.module | 1.54 KB | Geary |
| #9 | geary-2005-09-15.excerpt.module.patch | 1.66 KB | Geary |
| #4 | 2005-09-07.excerpt.module.patch | 1.58 KB | zach harkey |
| geary-2005-03-08.excerpt.module.patch | 1.85 KB | Geary |
Comments
Comment #1
zach harkey commentedAside from the error (patch: **** malformed patch at line 33: }) , (if you apply it by hand) this patch is awesome. It completely fixes the excerpt module in 4.6 which, otherwise, is completely useless. Let's do whatever we need to do to get this patch accepted into the module.
Comment #2
zach harkey commentedThis patch used to work great. Under Drupal 4.6.2 however, it no longer works. Is there something fundamentally different now in the way drupal handles teasers?
Comment #3
zach harkey commentedI must be the only one who uses this module. Because without this fix it is completely broken. Is there another module that works, that everyone is using -- or do people just not need excerpts these days?
Comment #4
zach harkey commentedOk, I got it working. There were a few problems with Geary's patch that were causing it not to apply. This is the first patch I have ever attempted but I have tested it and it seems to apply to the CVS version fine. Once applied, every thing works perfectly.
Comment #5
thomaslaw commented+1 much better.
Comment #6
ñull commentedI don't get this patch installed. It is all HTML and patch cannot read that. Could that be solved please!
Comment #7
ñull commentedWith some cutting and pasting I tried to apply this patch but I get the message:
patching file excerpt.module
Hunk #2 succeeded at 26 with fuzz 1.
This is not the normal message I get when patching and afterwards excerpt remains useless. Changes a make in the excerpt (teaser) are visualised in the preview but are not updated in the node view. Weird.
Comment #8
Geary commentedHi guys, I'm looking at this code some more, and part of it looks just wrong (aside from the patch problems). I should have a better version ready today. Will upload the complete file as well as the patch. :-)
Comment #9
Geary commentedHere is a good patch that should apply cleanly to version 1.5.2.1 of the excerpt module dated 4/23/2005. Zach, this restores one thing that got dropped out of your previous patch: the ability to specify "no teaser" by putting a space character in the excerpt field. (It would be nice to have a checkbox or radio button for this, but at least this lets you do it.) While I was looking at the code, I corrected the function signature for the excerpt_nodeapi function.
Note that there is a bug in the attachment module that affects the excerpt module. When you have the attachment module installed, every post has a "read more" link even if it shouldn't. I will submit a patch to the attachment module to fix this in just a bit.
Comment #10
Geary commentedAnd here is a copy of excerpt.module that includes the above patch, for easy downloading.
Comment #11
Geary commentedThe bug fix I mentioned above for the attachment module is here.
Comment #12
GWL commentedTested it using Drupal 4.6.3 and it worked like a charm. Thanks!
Comment #13
noid commentedCan't make it work using Geary's update (even the original one). Am using 4.6 and applying it on a flexinode type. Might be a flexinode or TinyMCE issue -- in the Excerpt textarea, can't see the the filters below the textarea. Also, default Excerpt is the the teaser and any flexinode field enabled in the teaser.
Any ideas? :)
Comment #14
zach harkey commented+1 Works like a charm. Too bad it will never get committed since no one maintains this module.
Comment #15
hayesr commentedCommitted the patch to the 4.6 branch. I am taking Zach Harkey's word that it works.
Comment #16
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.