In Drupal's page.tpl.php
foreach($node->og_groups as $test) { dpm($test); }
Gives me a '61' http://img.skitch.com/20091229-ekf6xqg5dxq6cgjsgfty74umfx.jpg

But when I use foreach($node->og_groups as $test) { print_r($test); }
Nothing showed up.
I'm not too sure how $node behaves in page.tpl.

Will appreciate if anyone can point me in the right direction.

Comments

nevets’s picture

In page.tpl.php, $node is only set when viewing a path of the form node/{nid} (unaliased path).

$node->og_groups I believe is only set if the node belongs to a group.

For your second case you probably want

<?php
foreach($node->og_groups as $test) { print $test; }
?>

or

<?php
foreach($node->og_groups as $test) { print print_r($test, TRUE); }
?>