Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.
-
cpezzer #1
Spry Widget Conversion
Hello everyone, thanks for looking.
I have some php code I have developed that which creates a web-site navigation
menu with a list of main menu items. When you click on an item it reveals a sub-
menu and then once a sub menu option is clicked on, it then highlights that
page you are currently on, on the actual menu itself.
The problem I have is that on one web host I use it comes up listing
substr_count errors whilst on another it doesn't.
Could anyone please advise why this might be and how to resolve this? (The
code is below).
Secondly could anyone advise how I might transfer this styling/menu to a
Spry-widget menu in dreamweaver? (I'm doing this for a university society as
they need the
siteto be easily maintainable once I have left). I originally wrote the site
in PHP but a change to the requirements specification then asked for it to be
Dream-
weaver compatiable. I have access to the socities copy of Dreamweaver CS4 -
but not at home so please be patient if I take time to reply as it will take
time to
update the site.
Thank you in advance for your advice.
<html>
<head>
<LINK rel="stylesheet" type="text/css" href="styles/menuStyles.css">
</head>
<body>
<br><br><br><br><br>
<?php
class MenuItem {
var $name;
var $url;
var $submenu;
function MenuItem($in1,$in2,$in3) {
$this->name=$in1;
$this->url=$in2;
if ($in3=="") {
$this->submenu=FALSE;
} else {
$this->submenu=$in3;
}
}
}
$menu1= array (
new MenuItem("Page 1","page.php",""),
new MenuItem("Page 2","page.php",""),
new MenuItem("Page 3","page.php",""),
new MenuItem("Page 4","page.php",""),
new MenuItem("Page 5","page.php","")
);
$menu2= array (
new MenuItem("Page 1","page.php",""),
new MenuItem("Page 2","page.php",""),
new MenuItem("Page 3","page.php",""),
new MenuItem("Page 4","page.php",""),
new MenuItem("Page 5","page.php","")
);
$menu3= array (
new MenuItem("Page 1","page.php",""),
new MenuItem("Page 2","page.php",""),
new MenuItem("Page 3","page.php",""),
new MenuItem("Page 4","page.php",""),
new MenuItem("Page 5","page.php","")
);
$menu4= array (
new MenuItem("Page 1","page.php",""),
new MenuItem("Page 2","page.php",""),
new MenuItem("Page 3","page.php",""),
new MenuItem("Page 4","page.php",""),
new MenuItem("Page 5","page.php","")
);
// if no menu vales are set - search the menu system
if (!isset($menu) || !isset($submenu))
list($menu,$submenu)=searchmenu(basename($PATH_TRA NSLATED));
function searchmenu($phpfile) {
global $mainmenu;
$menu=0;
$submenu=0;
foreach($mainmenu as $menuitem) {
$menu++;
if (substr_count($menuitem->url,$phpfile)) {
$submenu=0;
break(1);
}
if ($menuitem->submenu) {
global ${$menuitem->submenu};
$submenu=0;
foreach (${$menuitem->submenu} as $submenuitem) {
$submenu++;
if (substr_count($submenuitem->url,$phpfile)) {
break(2);
}
}
}
}
return array($menu,$submenu);
}
?>
<br/>
<br/><br/><br/>
<table width="160" border="0" cellspacing="0">
<?php
$t1=1;
foreach ($mainmenu as $menuitem) {
echo "<tr class=\"menubox\">\r\n";
echo "\t<td width=\"10px\" ";
if ($menu==$t1 && $submenu==0) {
echo "class=\"menuselected\"";
} else {
echo "class=\"menuunselected\"";
};
echo "> </td>\r\n";
echo "\t<td colspan=\"2\" width=\"100%\" ";
if ($menu==$t1) {
echo "class=\"menuhighlight\"";
}
echo ">\r\n";
echo "\t<a href=\"";
echo $menuitem->url;
if (substr_count($menuitem->url,"?")) {
echo "&";
} else {
echo "?";
}
echo "menu=".$t1."\" class=\"menu\">";
echo " ".$menuitem->name;
echo "</a>\r\n";
echo "\t</td>\r\n";
echo "</tr>\r\n";
if ($menuitem->submenu && $menu==$t1) {
$t2=1;
foreach (${$menuitem->submenu} as $submenuitem) {
echo "\t<tr class=\"menubox\">\r\n";
echo "\t\t<td width=\"10px\" ";
echo "class=\"menublank\"";
echo "> </td>\r\n";
echo "\t\t<td width=\"10px\" ";
if ($submenu==$t2) {
echo "class=\"menuselected\"";
} else {
echo "class=\"menuunselected\"";
};
echo "> </td>\r\n";
echo "\t\t<td class=\"menusub\" width=\"100%\">\r\n";
echo "\t\t<a href=\"";
echo $submenuitem->url;
if (!substr_count($submenuitem->url,"?")) {
echo "?";
} else {
echo "&";
}
echo "menu=".$t1."&submenu=".$t2."\" class=\"menu\">";
echo " ".$submenuitem->name;
echo "</a>\r\n";
echo "\t\t</td>\r\n";
echo "\t</tr>\r\n";
$t2++;
}
}
$t1++;
}
?>
</table>
</body>
</html>
cpezzer Guest
-
Automatically Animating Spry Accordion Widget on PageLoad
I've been searching and searching and still can't find a clue as how to make the Spry Accordion Widget automatically open the next panel. I want the... -
Spry Sliding Panel Widget
I have tried to use the Spry Widget Sliding Panel code from the Adobe tutorial and I keep getting an error message. The message is that "Spry" is... -
Editing CS3 Spry widget
Hi, I have created a accordion menu using a spry widget built into Dreamweaver CS3. However I want to amend this so that the menu is collapsed... -
Unordered list bullets and Spry Accordion widget
In all browsers except IE (surprise, surprise!), the page works fine. Otherwise the bullets in my unordered list appear at the bottom of the... -
Spry menubar widget, submenu background different color
Hello, Who knows if it is possible to assign different background-colors to main- and submenulevels? Regards, Dik



Reply With Quote

