Is there some built-in option for custom teasers in Drupal 5?
There's the automatic "Length of trimmed posts:" option, of course, but for many sites, custom-made teasers are better.
I suppose there the old options for "<--BREAK-->" tags in the body text may still work, but I hate messing up the body text that way – and it still only allows an excerpt from the body text, not a custom teaser.
Under 4.x, I relied upon the excerpt module, and then the (IMO much better) nodeteaser module. But 5.x versions aren't available, and when I try nodeteaser 4.x under Drupal 5.0, it doesn't even show up on my site's Modules admin page.
An I missing some obvious built-in feature of Drupal 5 for adding custom teasers?
Comments
Hi
Without a contributed module, you have to insert that (x)html comment to get the teaser to break where you want it to break :
<!--break-->--
I see. It would be interesting indeed to have a custom teaser, like an "abstract" for a scientifical article.
Maybe it will be possible with a contributed module.
Anyone ?
Caroline
Teasers in Drupal 5
Caroline,
There already are contributed modules – excerpt and nodeteaser – but both have only 4.x versions. The latter doesn't work for me in 5.0; the former I haven't tried, as I don't like it much.
As for purpose: There's actually a function (contrib module?) to add abstracts to a node in 4.x (don't know about 5.0), which I assume is aimed at scientific journals and the like. AFAIK, though, there's not an easy option to make a teaser out of that.
The reason I want custom teasers is very mundane. Think of almost any news-type site: On the site's front page, you'd want to list the article title, followed by a teaser like, say, "In his latest report, Drew Pal uncovers the latest anti-consumer schemes by Megasoft." Then you click to read the whole article.
That little text blurb introduces the article nicely, but doesn't belong inside the article itself. That's the kind of thing for which a custom teaser is perfect, and for which the standard "trimmed post" or "
" (thanks, chill35!) methods don't help out.
If there's no 5.0 custom teaser function I'm missing, the only thing to do may be to hack something, or wait for excerpt and/or nodeteaser modules to be updated.
Thanks for the comments!
...
Rather then hack something together yourself, why don't you try to upgrade your preferred 4.7 module? If you succeed, you can create a patch and submit it fo rth emodule contributor to apply to the benefit of everyone else. :)
There is this page: http://drupal.org/node/64279
Also, the last Lullabot podcast mentions some tools to help upgrade modules as well.
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide
Re DIY
Whenever possible, I'd much rather jump in and help than say, "someone oughta do something!"
In this case, though, my first reaction is, "Upgrade the module!? I wouldn't have a clue what to do or how!!"
Then again, who knows; with that helpful page you referenced, I should at least take a peek under the hood and see how hard it looks. I'll poke around...
How did it go, under the
How did it go, under the hood? :) I would be absolutely thrilled to see a excerpt for 5.0.
I upgraded to 5.0 and really need a way to show small images in the teaser part.
If there is anything I can do, just let me know.
Under the hood...
Thanks for asking. I'm sorry to report that I wasn't up to the task.
With the handy instructions on updating modules, I – a rank amateur in these waters – made a little interesting headway, including creation of the .info file needed by Drupal 5 to recognize the module at all.
However, once inside the guts of the module, I wasn't able to connect the instructions and examples with the precise mods required of the module code. Making some haphazard guesses, I made a version that didn't blow up or anything, but didn't work either.
I see that other parties are now hard at work on the module update, and I thank them for it. Me, I still want to contribute in significant ways; I'll pick my initial fights with care while building the skills to approach the heavier stuff.
A preliminary patch for nodeteaser to work in drupal 5.0
Try this
The best way is to create custom field
I agree that custom teasers are absolutely vital.
Excerpt and nodeteaser were irritating me because they displayed the teaser option for every content type including forum topics for example which is very bad for usability etc.
I found that the best way was simply to use CCK and create your own custom teaser.
You can then attach it to whichever content type you want and still use the default Drupal teasers on other content types.
All you have to do then is disable CCK from displaying the teaser and edit your node.tpl.php pages to display the custom teaser instead of content using an if statement.
CCK to create custom teasers
Thanks for the comment! Since my original question, nodeteaser has been made available for Drupal 5, and I use it regularly. But for reasons you point out, it's still not ideal (just a couple days ago I started a new blog with Drupal teasers as my first rant: http://www.drupalace.com/blog_entry_drupal_mystery_1_teasers_2007_06_25 ).
Your suggestion may be a great way to handle things. I've played with CCK just a little, for new content types; I haven't yet mucked with existing types. I'll have to do some poking around and report on how things worked out. In the meantime, thanks again for the pointer in a promising direction.
--------
One Drupal non-guru's slow road to enlightenment: http://www.drupalace.com
hi anonymouscowards, This is
hi anonymouscowards,
This is how I thought it could be done. could you go into more detail how to do that, or is it summarised anywhere to get me started? thanks, tom
subscribing
subscribing
How to do the "if"
Anonymouscowards,
Great idea. I followed it and all is well... except that I don't know how to do the "if" statement in the template. I don't know what the test is for "if this is in a list" to tell the template file not to print the part of the body that is the normal teaser. (I am using a version of the Garland theme, which seems to use the same file for formating list views and single page views.)
So I get two teasers in list views when I have a custom teaser.
Help?
I think you can now use this
I think you can now use this instead of messing in node.tpl.php: http://drupal.org/project/cck_teaser_field.
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk