I have a list of node ids and I want to display the 'page' view of each one. For various reasons, I don't want to do this with views, and don't think I should need a module. Just an API call to theme('node')
. Something like:
$nids = array(3,4,5);
foreach ($nids as $nid) {
$node = node_load($nid);
$result .= theme('node', $node);
}
but I'm not getting back the full page view of the node. I added this to my node-[type].tpl.php file:
if ($page) print "PAGE MODE ";
else print "NOT PAGE ";
if ($teaser) print "TEASER MODE ";
else print "NOT TEASER ";
and got:
NOT PAGE NOT TEASER
I seem to be in some kind of limbo. I suspect开发者_开发知识库 there's an argument that I add to the theme function, but the terms are all so general (theme, teaser, page, node), I'm having trouble with my google-fu.
try node_view() http://api.drupal.org/api/function/node_view/6
There it is! http://api.drupal.org/api/function/theme_node
I needed theme('node', $node, false, true)
. (Although my $content
variable still isn't getting fully populated. Hmm..)
精彩评论