I have nodes of two different content types and want to output them interlacing in a view. So nodes of type A are on odd places and nodes of type B on even ones.

Is there a straight-forward way to do this?

1 Answer 1


You could create a view that outputs the two node types and then use hook_views_pre_render() to sort, shuffle, or arrange the $view->result array any way you wanted. Then when it is rendered in the next steps, it would be printed however you wanted. You would hook into this like:

function YOURMODULE_views_pre_render(&$view) {

  if ($view->name=='thisistheviewyouarelookingfor') {

    // do whatever you want with $view->result[]



MORE INFO: $view->result[] is an array of "rows" basically, eg $view->result[0] contains all the raw data that makes up the first row, $view->result[1] is the second, etc.

  • Great! I knew it must be simple :) Apr 19, 2012 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.