Hi,

I have recently produced a module to strip HTML and PHP tags from teasers, as required by a friend's site. I was looking to contribute this module (teaserstripper) but I wonder whether you would be interested in including this functionality into your existing module. I think that enhancing an existing module would be better than creating a new module with similar functions.

My module would add 2 additional fields to the global post settings and content type settings:

  • Checkbox: Strip HTML and PHP tags from teasers
  • Textfield: Allow these HTML tags to be included

My module works on two of the hook_nodeapi operations:

  • presave: Overwrite the teaser (node_teaser) with a stripped (strip_tags) version of the node body.
  • prepare: Prepare the teaser attribute for the node add/edit form.

Anyway, if you are interested I would be happy to submit a patch. If not then I will contribute this as a separate module.

Please let me know.

Thanks in advance!
~ap

Comments

joachim’s picture

Hi.
This sounds to me like it would be better in a separate module.
I'm generally in favour of modules doing a simple, clear task, especially when they tweak Drupal core. It keeps the code simple to understand and maintain, and users only have to run the code they need (in this case, there's no guarantee that someone after different length teasers would also want tag stripping).

What we could do however is make sure this module and yours work together -- if your module comes later in the system table, then it can strip tags from the $node->teaser that teaserbytype has set.

Good luck with your module :)

By the way, have you considered rather than stripping tags, applying a separate input format to teasers? That would give you access to the HTML stripping filter in core, and allow other possibilities too.

aspope’s picture

Hi, thanks for your reply. It took me a while to discover it, since I don't seem to be receiving new message alerts from Issues.

I do understand, and I agree with you. One question: How would I ensure that my module appears lower than teaserbytype in the system table?

I will take a look at your suggestion of a separate input format, because it might be better to make the module more flexible - it's a bit dumb as it stands. :-)

Thanks very much,
~ap

joachim’s picture

Status: Active » Closed (won't fix)

I think for module weight you have to directly alter the system table in your hook_install. I've seen several modules do it.
Though perhaps on D6 there is a cleaner way.

Closing as wontfix.
Happy coding :D