In D6 the node title can be hidden with using the third parameter in the node_view() function.

http://drupal.org/update/modules/6/7#node_view

$nstruct = node_build($my_nid, 'teaser');
$output = drupal_render($nstruct);

This code should replace node_view in D7, but there is no way to hide the node title as the template_preprocess_node() always expects that there is a node title and node.tpl.php always displays it.

The attached patch is not a really good solution just a quickfix.
to hide the node title add unset($nstruct['#node']->title); before drupal_render

CommentFileSizeAuthor
node_title.patch1.05 KBpasqualle

Comments

pasqualle’s picture

Status: Active » Needs review
conortm’s picture

Looks like this issue is moot per #658364: Does build/view/formatter terminology make sense?. I've contacted Pasqualle to confirm and close.

retester2010’s picture

node_title.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, node_title.patch, failed testing.

murz’s picture

Is there any recommended way to hide node title on current Drupal 7.4 version without this patch?

rvb’s picture

Hi Murz,
I found this module that excludes node titles by content type or by specific node: http://drupal.org/project/exclude_node_title
But with my D 7.4 install it's still not working.
Maybe you have more luck. Let us know if you have a solution.

marcingy’s picture

Category: bug » support

Moving to a support request as the original issue is not a bug.

rvb’s picture

I designed my Drupal 7.4 template with Artisteer 3, that's probably why I have this issue.
The Exclude node title module didn't work, but I changed the node.tpl.php code:

Original:
----------
echo art_node_title_output($title, $node_url, $page);

Enhanced:
--------------

 if ($nid != 35 && $nid != 36 && $nid != 34 && $nid != 37 ) {
echo art_node_title_output($title, $node_url, $page);} 

where nid are the node IDs of the pages where I don't want the title to be displayed twice.

pasqualle’s picture

Status: Needs work » Fixed

- the section for node_view in the D6-D7 module update handbook is removed.

the title can be hidden as

$node = node_load($nid);
$node->title = NULL;
$renderable_array = node_view($node, 'teaser');

code from ctools\plugins\content_types\node\node.inc ctools_node_content_type_render()

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.