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
Comment #1
marcoBauli commentedyes, 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
Comment #2
marcoBauli commentedSame problem for other contributed modules:
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!)
Comment #3
marcoBauli commenteddid 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:
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
Comment #4
marcoBauli commentedsubmitted 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:
Good luck!
Comment #5
(not verified) commented