This screencast is a part of the epic learning series "Four weeks of Drupal", chapter "Introduction to theming". You can view the full series at dev.nodeone.se/en/four-weeks-of-drupal.
Please post any comments over there, or we won't see them. Sorry.
This screencast discusses render arrays in a semi-structured way. Here is some kind of summary:
* Most dynamic things in Drupal are represented as render elements to the theme layer. (This is similar to form elements in the form API – and in some aspects identical to it.) Flat markup is actually a special case of render elements!
* The render elements contain all the information necessary to render the element. (Duh!)
* Render elements can be lumped together into render *arrays*. Often times, the render arrays have a tree structure with elements inside elements.
* When printing out an array or an individual element in your theme, you should use render($element).
* If you want to exclude parts of the array you're printing (to save for later or just hide completely), you can use the hide($array['element']) function.
* Once rendered, the elements are set to hidden automatically. You can make them un-hidden by using the show($array['element']) function.
* The top-level element being rendered is unhidden first, to explicitly rendering an element will print it out – even if it was hidden to start with.
Two examples of using render arrays are shown: one being the node.tpl.php, one being hook_page_alter. The latter should be used with care.