/** Fine-grained node placing in themes. This is a technique that allows you to deal with each node separatelly (e.g. place a node right, another left, two in middle.. etc). This solution tries to store all the nodes in an array, and give that to the themer so they can decide how to ouptut these nodes. For example, if you want to display them in two columns, you will need to iterate over the array, print the odd in left column, and even on right column. To make this work, first you need this code in your template.php: */ function yourtheme_node($node, $teaser=0, $page=0) { set_themed_node(phptemplate_node($node, $teaser, $page)); } function set_themed_node($node=NULL) { static $themed_nodes; if ($node) { $themed_nodes[] = $node; } else { return $themed_nodes; } } function _phptemplate_variables($hook, $vars) { $myvars = array(); switch ($hook) { case 'page': $myvars['themed_nodes'] = set_themed_node(); break; } return $myvars; } /** Now in your page.tpl.php, you have a new array called $themed_nodes, each node is an item in the array. So you can do something like (just rough example): */ $mynode) { if ($key%2) { $odd_nodes .= $mynode; } else { $even_nodes .= $mynode; } } ?>
/* Hope it was any useful to you. - alienbrain */