How do I render a node returned by the Drupal search module? I'm using Drupal 7 to build a fairly simple directory site. I'm trying to theme my search results page the same as a taxonomy page, but as you may know, the results arrive by a completely different process in those two situations. I've copied the search-result.tpl.php file from the Search module to my own theme, and am trying to take advantage of the $result variable returned by the module. However, it doesn't seem to be as simple as print render($result);

I tried to isolate the relevant node object within $result and perform render() on it, like so:


$content=Array(); $content['#node'] = $result['node'];
print render($content);



But that just throws an error (can't use object as array) or simply returns nothing.

$result['node'] definitely contains the fields I want to echo on the page, so what am I doing wrong?
You need to prepare a view for the node object:

$view_mode = 'teaser'; // Or whatever
$view = node_view($result['node'], $view_mode);
print render($view);