PDA

View Full Version : vertical menu bar with SSI


wortmann
07-12-2011, 04:52 PM
I'm new to all of this. But i've started to design a menu bar (vertical). I've decided to make one (template) vertical menu using spry assets so i can use them in all my pages and even in multiple websites.

However i cant get the hang off the SSI.
I've created a HTML index page (just for practice). Here is the code:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Spry menu</title>
<!--#include virtual="/includes/menu.html" -->
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
</head>

Then i've created a menu.html page and this one is located in the root/include folder and it contains the following:


<head>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />

</head>
<body>
<ul id="MenuBar1" class="MenuBarVertical">
<li><a class="MenuBarItemSubmenu" href="#">Item 1</a>
<ul>
<li><a href="#">Item 1.1</a></li>
<li><a href="#">Item 1.2</a></li>
<li><a href="#">Item 1.3</a></li>
</ul>
</li>
<li><a href="#">Item 2</a></li>
<li><a class="MenuBarItemSubmenu" href="#">Item 3</a>
<ul>
<li><a class="MenuBarItemSubmenu" href="#">Item 3.1</a>
<ul>
<li><a href="#">Item 3.1.1</a></li>
<li><a href="#">Item 3.1.2</a></li>
</ul>
</li>
<li><a href="#">Item 3.2</a></li>
<li><a href="#">Item 3.3</a></li>
</ul>
</li>
<li><a href="#">Item 4</a></li>
</ul>
<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
</script>
</body>


I can see the menu in the design window of dreamweaver but when i go to live view it's not there. or if i want to see the result in IE it redirects to the include/menu.html and it comes up with internet explorer can't open the page.

is there anyone out there that could help?

gentleone
07-12-2011, 05:45 PM
a few things:

in order to make use of PHP includes you need to save your index page as index.php and most importantly your web server must have PHP installed on it.
if that's okay, you should include your menu (which if I were you I would also save as menu.php) not in between the head tags but in between the body tags.
last thing... your include should look something like this: <?php include('includes/menu.php'); ?>

wortmann
07-12-2011, 09:59 PM
Hello,

I've done what you said.
My webserver has php installed. I'm only testing this out on my local PC.
I'm creating the website using DW cs5.

however i still have the same problem.

Just to make sure i did everything right:
I've copied the include (<?php include('includes/menu.php'); ?> ) within the body tag.
I've save the index.html file as a .php file, and have done the same with the menu.html.

in dreamweaver i do het the warning: An unknown error occurred while discovering dynamic-related files.

gentleone
07-13-2011, 10:37 AM
If you want to test PHP files locally, then you need to have a server (Apache) installed locally as well. PHP is a server side language, so no server, no PHP.

Another thing what I didn't see before is that your include menu.php contains head and body tags, and you also include the javascript files again.
Your menu.php file should only contain this:

<ul id="MenuBar1" class="MenuBarVertical">
<li><a class="MenuBarItemSubmenu" href="#">Item 1</a>
<ul>
<li><a href="#">Item 1.1</a></li>
<li><a href="#">Item 1.2</a></li>
<li><a href="#">Item 1.3</a></li>
</ul>
</li>
<li><a href="#">Item 2</a></li>
<li><a class="MenuBarItemSubmenu" href="#">Item 3</a>
<ul>
<li><a class="MenuBarItemSubmenu" href="#">Item 3.1</a>
<ul>
<li><a href="#">Item 3.1.1</a></li>
<li><a href="#">Item 3.1.2</a></li>
</ul>
</li>
<li><a href="#">Item 3.2</a></li>
<li><a href="#">Item 3.3</a></li>
</ul>
</li>
<li><a href="#">Item 4</a></li>
</ul>
<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
</script>

wortmann
07-13-2011, 02:08 PM
i've got apache and sql server running. i did make the mistake of the body tag. will have a look