/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * * flat Suckerfish menu * * @version" 0.1 * @author: Vaska * @author: orionrush * @use: 1 - Save this clip as plugin.suckerMenu.php and place it in ndxz-studio/site/plugin * @use: 2 -in your site template (ndxz-studio/site/your-template-name/index.php) replace <plug:front_index /> with <plug:suckerMenu /> * @inspiration: http://www.htmldog.com/articles/suckerfish/dropdowns/ * **/ function suckerMenu() { $OBJ =& get_instance(); global $rs; $pages = $OBJ->db->fetchArray("SELECT id, title, url, section, sec_desc, sec_disp, year, secid FROM ".PX."objects, ".PX."sections WHERE status = '1' AND hidden != '1' AND section_id = secid ORDER BY sec_ord ASC, ord ASC"); if (!$pages) return 'Error with pages query'; foreach($pages as $reord) { 'id' => $reord['id'], 'title' => $reord['title'], 'url' => $reord['url'], 'year' => $reord['year'], 'secid' => $reord['secid'], 'disp' => $reord['sec_disp']); } $s = ''; $s .= "<ul id='suckerNav'>\n"; foreach($order as $key => $out) { if ($out[0]['disp'] == 1) $s .= "<li class='section-title'>" . $key . "\n"; //need to insert if else for cases where Display Section Title is off, where by we need a new ul section for the title-less section if ($out[0]['disp'] != 1) $s .= "<li>\n"; $s .= "<ul>\n"; foreach($out as $page) //adds the class noSectTitle to the first li element in ul sections where the user has turned off 'Dispaly Section Title' if ($out[0]['disp'] != 1){ $active = ($rs['id'] == $page['id']) ? " class='active noSectTitle'" : " class='noSectTitle'"; $s .= "<li$active><a href='" . BASEURL . ndxz_rewriter($page['url']) . "' onclick=\"do_click();\">" . $page['title'] . "</a></li>\n"; } else { { $active = ($rs['id'] == $page['id']) ? " class='active'" : ''; $s .= "<li$active><a href='" . BASEURL . ndxz_rewriter($page['url']) . "' onclick=\"do_click();\">" . $page['title'] . "</a></li>\n"; } } $s .= "</ul>\n</li>\n"; } $s .= "</ul>\n"; return $s; } ?>