More info needed about relative paths.

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
Rickstre
Beginner
Beginner
Posts: 6
Joined: Thu Nov 18, 2004 1:32 am

More info needed about relative paths.

Post by Rickstre »

The structure of my site is

http://www.sitename.com
.....htdocs
........root
........libs
..........navbars
.............menu.inc.php

(root and libs are on the same level, but navbars is below libs)

The code in menu.inc.php is:
<script type="text/javascript" src="http://www.sitename.com/libs/navbars/mi ... "></script>
<param copyright="JavaScript Menu by Milonic - http://milonic.com"></param>

<script type="text/javascript">
<!--
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=http://www.sitename.com/libs/navbars/mm ... /scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=http://www.sitename.com/libs/navbars/mm ... /scr"+"ipt>");
-->
</script>
type=text/javascript></SCRIPT>
?>
</head>
<body>
<script language=javascript>
<?
include("$DOCUMENT_ROOT/libs/navbars/menu_data.js.php");
?>
</script>
The menu is called by index.php in "htdocs"

Portion of index.php:
<?
if ($frames) {
?>
<html>
<head>
<title>pagename</title>
</head>
.
.... No frames message
.
} else if (!$index) {

?>
<script language="javascript">
<!--
top.location.href='http://www.sitename.com/root/index.php?frames=true';
//-->
</script>
<?
exit;
}
?>
...........html code......
<?
require("$DOCUMENT_ROOT/libs/navbars/menu.inc.php");
?>
..........more HTML code....
"DOCUMENT_ROOT" above = 'http://www.sitename.com"

I also have tried prefixing the milonic_src.js, mmenuns4.js, and mmenudom.js files with all forms of:

http://www.sitename.com/libs/navbars/
/libs/navbars/
/navbars/
and even...http://www.sitename.com/htdocs/libs/navbars/ (though htdocs should not be necessary since this is root).

However, unless I place all files into the directory fron which a menu is called I get a JS error that indicates that the milonic_source.js file (and other js files) was not found pointing to the directory from which the script is run. Indeed if I place the three js files in the directories from which the script is run the menu works. However the relative path seems to be ignored.

I am NOT the original author of the site but now am charged with maintaining it. I cannot see how the line in index.php:
is causing this problem. But perhaps a guru here can. However this seems to be needed for authentication of the site.

Anyone have a method that can be used to fix this problem? AAARRRAAAGGGHHHH! :!: :!:

BTW since the site on which this is located is password protected if you need the URL I will have to set up a temporary login and password.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

I think you might have to put up something for people to check and see what's happening, since no one has answered. Or you might need a new 'topic' heading to include something about the php coding and calling the menu not working and giving a js error. I'm sorry I can't help because I know nothing about php.

Ruth
Rickstre
Beginner
Beginner
Posts: 6
Joined: Thu Nov 18, 2004 1:32 am

Post by Rickstre »

I found the problem last Friday... The Menu system is running on an Apache server. Apache treats the "libs" directory differently and does not allow external links directly to the "libs" directory. Moved everything to a new directory "common" and all is well!

Rick
Post Reply