Teasers in blocks not correctly rendered?

NikLP - November 28, 2007 - 18:56
Project:Similar Entries
Version:HEAD
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:postponed
Description

I'm using cck_teaser_field to create a separate teaser field than the normal one, which is perfectly fine. This is respected by cck and views alike as the "normal" teaser. This doesn't seem to affect the "similar" module though. I get the original drupal-style teasers, which I don't want in that block.

Also, the theme function is... massive! Having the database queries in that function means that it is almost impossible to override the theming of the function for a non-developer (and even then...!) I suggest the function would be best rewritten as two functions: one a db function, and the theme function should be passed a list of nodes to theme as the themer sees fit. This would be easy to override then.

Doesn't change the functionality problem though! :)

Cheers for any input.

#1

deekayen - November 28, 2007 - 19:14
Version:5.x-2.0» HEAD
Category:bug report» feature request
Status:active» postponed

What you're talking about is really two separate issues and should be filed as such in the future.

Similar was made before CCK and therefore didn't take into account CCK. Since CCK is an add-on module (albeit a popular one), I've long considered this a feature request, not a bug. An API has just recently evolved to implement this more cleanly, so I'm considering the CCK issue something for Drupal 6.

You're right about the cutting up theme function and I don't have a problem cutting it up, but I'll do that for Drupal 6 as well. I'm in a forward-looking stance for the foreseeable future.

If someone other than me writes the patch (for any of the Drupal versions), that'll just close this issue that much faster.

#2

NikLP - November 29, 2007 - 16:13

Thanks for the swift reply. You're kinda right about that being two issues - the reason I left it as one is because I looked at the code and thought they were essentially related.

Looking at the theme function, I see line 390: (there's a typo in the class too, btw ;)

<div class="simlar-teaser">'. check_markup($content->teaser, $content->format, false) .'</div>'

I wonder if because this is in the theming function, we could just override that function and use a different value instead of $content->teaser? And indeed, is there a different way of writing that small segment which would overcome the CCK compatibility issue also?

When I've got a minute I'll have a look and see if I can't find out. Any feedback pro/con what I've said/suggested here would be helpful tho, thanks.

#3

deekayen - November 29, 2007 - 16:26

Wow, that typo has been there a very long time. I fixed it. Your fame and fortune: http://drupal.org/cvs?commit=89667

#4

deekayen - November 30, 2007 - 03:26

The fact still remains that similar's theme function needs work, but if you want to go down the path of theme overrides, perhaps http://drupal.org/node/11811 will help.

 
 

Drupal is a registered trademark of Dries Buytaert.