Community Documentation

ARCHIVE: Example: How to Display a List View As a Mock Menu

Last updated March 26, 2011. Created by ashtonium on December 29, 2005.
Edited by linclark, merlinofchaos, sepeck. Log in to edit this page.

This is very much like the Summary View as a Mock Menu example.

<?php
function THEMENAME_views_view_list_VIEWNAME($view, $nodes, $type) {
  foreach (
$nodes as $node) {
   
$output .= "<li class='leaf'>" . l($node->node_title, "node/$node->nid") . "</li>\n";
  }

  if (
$output) {
    return
"<div class='menu'>\n<ul>\n" . $output . '</ul></div>';
  }
}
?>

Archive

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.
nobody click here