Sure! The temptation with a server-side include is to get it to 'do all the work' for you. So, what folks often will try is to put a stylesheet link, an external script call and the markup for (in this case) the menu - all on one include page and then include that wherever the menu is desired. If all of your paths are absolute, this can sometimes work but, often it is just too much to expect.
With this script, the style link belongs in the head of the page. It is just one short line so, if it gives you any problem as an include (it could possibly be in a separate include for the head), just hard code it into the head of each page, this is the best way, hard coding the:
HTML Code:
<link rel="stylesheet" type="text/css" href="http://www.mydomain.com/style/sddm.css" >
into the head of each page that will use the menu.
Same thing with the script call except that it must be after the markup for this script. So, you could try putting it at the end of the markup in the include or putting it in an include that is used at the bottom of the page but, as it too is just one line, the best way is to put it on each page, just after the call to the include for the markup. Here is a rough overview of the ideal situation on a page using this menu via an include:
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" >
<link rel="stylesheet" type="text/css" href="http://www.mydomain.com/style/sddm.css" >
<title>JSwitch Slide Menu</title>
</head>
<body>
<% your include code here for the menu's HTML markup %>
<script type="text/javascript" src="http://www.mydomain.com/scripts/xpmenuv21.js"></script>
</body>
</html>
Now, as I mentioned, you may be able to get away with putting the script call and the style link on the include page or on separate includes that would place them in the appropriate spots on the page but, the above is the safest method.
Notes: Notice the use of absolute paths in the style link and script call. These are the type of paths that should be used in the menu's markup as well. I also mentioned before that this script will be partially inaccessible to non-javascript enabled browsers no matter how it is used if any of the menus are initially not shown:
HTML Code:
<div class="subMenu" style="display:none;">
Anything like the above in the markup will have this problem. Best to use:
HTML Code:
<div class="subMenu hide">
and have a separate script linked to the head with this code:
Code:
document.write('<style type="text/css">\n'+
'.hide {\n'+
'display:none;\n'+
'}\n'+
'<\/style>')
That way the subMenu will only be hidden if javascript is enabled.
Bookmarks