By sfa on
Hi All,
I've been having a problem for a while but I kept finding ways around it. Why is it that when I use the following code it doesn't work -
$currentnode = node_load(array('nid'=>31));
print $currentnode->teaser . "<br />";
The teaser, nid and title variables seem to work ok but when I try to print teasers or even attached images or other fields, it doesnt return anything.
Thanks!!!
Comments
Anyone? This must be a
Anyone? This must be a common problem surely.
Check out node_view
Depending on how much info you need:
Alan Davison
www.caignwebs.com.au
Alan Davison
Dude, you are a star, I
Dude, you are a star, I tried it and it works!!!
Just one last thing, that doesnt recognise the template created in contemplate, is there any way to use that layout?
You saved me SO much time.
Never used Contemplate
You will have all the data in the node, other than the stuff called via nodeapi alter. Throw in this step:
node_invoke_nodeapi($node, 'alter', $teaser, $page);
And see what comes out of:
$output = theme('node', $node, $teaser, $page);
Would be easier just to call node_view in this case, lol
Eg:
print node_view(node_load(array('nid' => $nid)), $teaser, $page, FALSE);
Alan Davison
www.caignwebs.com.au
Alan Davison
The node_view() worked,
The node_view() worked, thanks again, saved me days!!!
node_view() for printing teasers
Great stuff Alan.
node_view() allowed me to print my teasers through the fuzzy search interface instead of the lame default. Thank you