override node presentation from module

JoseOnate - May 9, 2008 - 11:32

Hi,

I am trying to override the presentation of my own node type. I want to get rid of the HTML created by the system (title, submitted info, etc), and replace the HTML with a simplified version.

Since this is a module to be redistributed I don't want to override the presentation at the theme / tpl level, but on the module itself.

Is this even possible? I've spent a while looking in the API and forums with no success.

Jose.

No, you do have the view

nevets - May 9, 2008 - 13:09

No, you do have the view hook but that only controls "content" portion of what is print out by node.tpl.php leaving the title, submitted info, terms and links.

Hmmm, presentation is what

gpk - May 9, 2008 - 13:57

Hmmm, presentation is what the theme layer is all about...

One option might be to ship the module with a template for your node type that can then be put in the theme folder.

Display of nodes (either as teaser or full node) is handled by http://api.drupal.org/api/function/node_view/5 which ultimately calls theme('node', ...). I think in D6 you have more options, but in D5 you might have to use http://api.drupal.org/api/function/hook_nodeapi/5 (or maybe even just http://api.drupal.org/api/function/hook_view/5, which is invoked in http://api.drupal.org/api/function/node_build_content/5) to put everything in the node content/body and unset title etc. ... not ideal but might work.

Also have a look at http://drupal.org/project/contemplate - might give you some ideas.

gpk
----
www.alexoria.co.uk

 
 

Drupal is a registered trademark of Dries Buytaert.