I've been using the Mediumvote module to rank my nodes and with the following hack in the mediumvote_nodeapi function I filtered out a node type to put my rankings in:
if ($node->type == "my_node_type") { ...make mediumvote widget... }

I'm not much of a programmer, but I copied this code from this site and it worked.

Later I installed the Contemplate module and it all worked fine, except when I used a template for my node type my rankings were gone.

Can somebody please explain how I can fix this?

Comments

marcoBauli’s picture

Title: Problem with simple Mediumvote hack after using Contemplate » Display ALL Variables for a type (not only CCK's ones)
Category: support » feature

yes, it looks like as soon as you touch the Teaser or Body template in /admin/node/types/content-yourtype/template, the template created gets rid of any variable that does not come with CCK.

I encountered the same problem for a type with enabled image_attach: when i modified the Body Template, my image was gone!

Of course it should be possible to add the variables in the Contemplate template text area manually, but for non-developers (as me and guess many others) is a pain to figure out WHAT these variables are ;-\

So i turn this post into a feature request:

Would it be possible to display in the "Teaser and Body Variables" ALL the variables effectively involved into a content-type, and NOT only the ones coming from CCK?

thanks lot

marcoBauli’s picture

Title: Display ALL Variables for a type (not only CCK's ones) » Output ALL variables (not only CCK ones)
Priority: Minor » Critical

Same problem for other contributed modules:

  • for Userreview module fields here.
  • for Content_taxonomy and Category modules here.

setting this to critical, as basically now Contemplate is not compatible with most contributed modules.
(please feel free to find a title that suits better the problem...non-geek here!)

marcoBauli’s picture

did some more testing:

seems that Contemplate picks some "random" variables from other non-CCK modules.
(To get to show those variables in the right field of Contemplate you need to install the module, activate it and associate it to the type you are building a template for)

For example:

  • for Userreview.module it recognizes the submission form, but no way to output medium vote or reviews themselves.
  • for Voting.module it just displays a completely unusefull $variable coming from the hook_settings
  • This issue is a total stop for this otherwise beautyfull module which basically plays well only with CCK and core. If you need more contrib modules to attach content to your nodes better opt for the good old node-content-type.tpl.php files.....pity

marcoBauli’s picture

Title: Output ALL variables (not only CCK ones) » How To make Contemplate work with other contrib modules
Category: feature » support
Priority: Critical » Normal
Status: Active » Fixed

submitted by jjeff on September 25, 2006 - 13:23

The ConTemplate module lists all of the attributes of the node object during the view phase of hook_nodeapi.

There are lots of modules "out there" that add information to the $node->body, but DO NOT add any information to the $node itself. For instance, IMO there should be $node->event_view for the information that normally gets prepended to $node->body. In this case the file listing information gets appended to the end.

You can create a patch for most modules by finding the module's implementation of hook_nodeapi (example event_nodeapi()) and finding a line that looks something like this:

$node->body .= $eventstuff;

or maybe:

$node->body = $eventstuff . $node->body;

and inserting a line something like this:

$node->eventstuff = $eventstuff;

just before it.

This way the $eventstuff will be available to ConTemplate separate from the body. It will show up in the listing within the template editing page and you can add it without having to call any special theme functions.

If you write these functions for these modules, PLEASE SUBMIT THEM as an issue for that module. This is the reason that ConTemplate is difficult to use with these modules.

I've looked at the hook_nodeapi() for upload.module and If you're concerned about hacking a module, it looks like you can also call the theme function directly from your content template like this:

 print theme('upload_attachments', $files); 

Good luck!

Anonymous’s picture

Status: Fixed » Closed (fixed)