Question: In Drupal's page.tpl.php   

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

```

Gives me  

[alt text http://img.skitch.com/20091229-ekf6xqg5dxq6cgjsgfty74umfx.jpg](http://img.skitch.com/20091229-ekf6xqg5dxq6cgjsgfty74umfx.jpg)

But when I do   

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

```

The value doesn't show up. this is kinda frustating..
Any help is appreciated.   

Cheers!

Answer: 
As [Steve Michel](https://stackoverflow.com/users/120773/steve-michel) suggested: Try doing a view source on the rendered page; it may be going to the top of the HTML and may not be visible in the browser output.

Drupal first executes all code, collecting output into a variable. At the very end, this variable is print out. If you print or var\_dump something in between, this will be at the very top of the output (since that's done before any of the regular content is printed).

You even figured out the answer: use drupal\_set\_message (for which dpm is an abbreviation I guess?) to insert text in a nicely formatted way, somewhere in the content part of the page rather than before the tag.

If you need to print out arrays, you can use `dpm(print_r($array, 1))` -- the 1 argument makes `print_r` *return* the formatted output (and pass it to `dpm`) rather than printing it out directly.
Try doing a view source on the rendered page; it may be going to the top of the HTML and may not be visible in the browser output.