Location: PHPKode > projects > SOS Webpages > includes/menu.php
<?php
// +----------------------------------------------------------------------+
// SOS Webpages is an easy-to-manage website management system
// Copyright (C) 2007 - 2010 HandsomeWeb
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
// Contact the author of this software at http://www.handsomeweb.com.
// +----------------------------------------------------------------------+

/*	includes/menu.php creates the main menu on every page.  It uses $menu_item_divider, which is
	defined in the template */

//Setting the default menu divider
if ($menu_item_divider=="") $menu_item_divider="<br />";
$dbh=mysql_connect($dbhhost,$dbhuser,$dbhpassword) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db($dbhdatabasename);
$query = "SELECT * FROM " . $dbprefix . "hw_pages WHERE pages_parent_id=0 ORDER BY pages_order, pages_menu_title";
$result=mysql_query($query);
$num=mysql_num_rows($result);
$menutext = "";
$i=0;
while ($i<$num){
	$menu_pages_menu_title=mysql_result($result,$i,"pages_menu_title");
	$menu_pages_uri=mysql_result($result,$i,"pages_uri");
	$menu_pages_id=mysql_result($result,$i,"pages_id");
  $menu_pages_new_window=mysql_result($result,$i,"pages_new_window");
	$menu_pages_hidden=mysql_result($result,$i,"pages_hidden");

	if ($menu_pages_hidden!="yes") {
		if ($i<>0) echo $menu_item_divider;
		echo "<a ";
		if ($menu_pages_new_window=="yes") echo "target='_blank' ";
		echo "class='menu' href='http://" . $site_uri .  "/index.php?pages_id=" . $menu_pages_id . "&amp;t=" . $menu_pages_uri . "'>" . $menu_pages_menu_title . "</a>";
  }
	$i++;
	}
mysql_close();

//If in edit mode show the edit menu link.
if ($admin=="admin") {
	echo $menu_item_divider;
	echo "<a class='menu' style='color:white;background-color:#3366CC;background-image:none' href='admin/admin_site_menu.php?sitelink=true'>" . EDIT_MENU . "</a>";
	echo $menu_item_divider;
	echo "<a class='menu' onmouseover=\"window.status='http://www.soswebpages.com/board/'; return true;\" onmouseout=\"window.status='';\" ";
	 echo "onclick=\"window.open('http://www.soswebpages.com/board/');return false;\" style='color:white;background-color:#3366CC;background-image:none' ";
	 echo "href='http://www.soswebpages.com/board/'>" . FORUM . "</a>";
	}
?>
Return current item: SOS Webpages