I can't believe I'm having so much trouble finding this in search and snippets. I know it is something very simple, but how do I print a specific node using php to call it for inclusion on the front page? In this case I don't want the title or links, just the node content, but that can probably be done in the stylesheet. Any help would be great.

Comments

kuba.zygmunt’s picture

jasonwhat’s picture

I tried this one but only got the teaser.

$node = node_load(array('nid'=>1));
$output = node_view($node, 1);
print $output;
yelvington’s picture

http://drupaldocs.org/api/head/function/node_view
node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE)

Description

Generate a display of the given node.

Parameters

$node A node array or node object.

$teaser Whether to display the teaser only, as on the main page.

$page Whether the node is being displayed by itself as a page.

$links Whether or not to display node links. Links are omitted for node previews.

Return value

An HTML representation of the themed node.

dublin drupaller’s picture

Jason,

Try this and let me know if it works for you..(change the $node_id to be the Node ID of what you want to display)

$node_id = "56";
$node = node_load(array('nid'=>$node_id));
print $node->body;

Dub

Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate

jasonwhat’s picture

Not sure why. I'm trying to print a "dashboard node" on the frontpage but not having luck. I probably need to keep some of the theming in tact.