I'm currently developing a module for Drupal 6, in which I have created a custom content type.

I'm able to create/update/delete a node of this content type by using hook_form, hook_insert and so on.

Now what I want is displaying the node when I click on it in my content list (tab "view"). I don't understand how to do this. Currently Drupal only displays a double dash for the title and antoher one for the body.

I tried using hook_view and hook_nodeapi with $op == 'view', but neither seem to work.

I think it must be a pretty basic thing, but I'm a Drupal noob and there are still a lot I don't understand about it.

Any hints would be great! Thanks!

有帮助吗?

解决方案

By default, viewing the title and body of a custom content node should "just work" as if it were any other node. Assuming your nodes are being inserted and updated correctly, then something else is breaking the content on view. Problems in your templates perhaps? (Double-dashes make me think of HTML comments.)

If you have to modify the node to display custom fields, then hook_view() is the right place. Be sure to call node_prepare() before you make your modifications:

/**
 * Implementation of hook_view().
 */
function MODULE_view($node, $teaser = FALSE, $page = FALSE) {
  $node = node_prepare($node, $teaser);
  return $node;
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top