PDA

View Full Version : problem with anylink dropdown menu in phpnuke



Genom
09-21-2006, 09:32 PM
hello I try to use anylink dropdown menu here is the example of the html
www.healthnfit.org/test/header.html

it works good alone as html page but when I use it as header for phpnuke it gives me errors in Internet Explorer
can someone help me please?

jscheuer1
09-21-2006, 09:57 PM
You should probably make the script and style external files. Use this for the script file (you should probably keep the numbered entities, the forum editor converted them to characters):


/***********************************************
* AnyLink Drop Down Menu- Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="http://www.healthnfit.org/modules.php?name=Forums&file=viewforum&f=4">מחקרים חדשים</a>'
menu1[1]='<a href="http://www.healthnfit.org/modules.php?name=Forums&file=viewforum&f=1">תזונה בריאות ודיאטות</a>'
menu1[2]='<a href="http://www.healthnfit.org/modules.php?name=Forums&file=viewforum&f=2">פתולוגיות ומחלות</a>'
menu1[3]='<a href="http://www.healthnfit.org/modules.php?name=Forums&file=viewforum&f=3">רפואה נטורופטית</a>'
menu1[4]='<a href="http://www.healthnfit.org/modules.php?name=Forums&file=viewforum&f=6">תוכניות אימונים וספורט</a>'
menu1[5]='<a href="http://www.healthnfit.org/modules.php?name=Forums&file=viewforum&f=5">פורום כללי</a>'
menu1[6]='<a href="http://www.healthnfit.org/modules.php?name=Forums&file=viewforum&f=7">תמונות הגולשים</a>'

//Contents for menu 2, and so on
var menu2=new Array()
menu2[0]='<a href="http://www.healthnfit.org/modules.php?name=Content&pa=showpage&pid=5">מי אנחנו</a>'
menu2[1]='<a href="http://healthnfit.org/models-healthnfit.htm">פינת הדוגמנים</a>'
menu2[2]='<a href="http://healthnfit.org/diet.htm">פינת הרזייה וחיטוב</a>'
menu2[3]='<a href="http://healthnfit.org/bodybuilding-of-HealthNfit.org.htm">פינת השרירנים</a>'
menu2[4]='<a href="http://healthnfit.org/the-best.htm">מאמן האלופים</a>'
menu2[5]='<a href="http://www.healthnfit.org/modules.php?name=Content&pa=showpage&pid=13">מכתבי תודה ממטופלים</a>'
menu2[6]='<a href="http://www.healthnfit.org/modules.php?name=Content&pa=showpage&pid=15">המלצותיכם אודותינו</a>'

var menu3=new Array()
menu3[0]='<a href="http://www.healthnfit.org/clinic.htm">קליניקה לבריאות וכושר</a>'
menu3[1]='<a href="http://www.healthnfit.org/personaltraining.htm">אימונים אישיים</a>'
menu3[2]='<a href="http://www.healthnfit.org/seminar.htm">הרצאות וסמינרים</a>'
menu3[3]='<a href="http://www.healthnfit.org/pegisha.htm">פגישת ייעוץ אישית</a>'
menu3[4]='<a href="http://healthnfit.org/tofes.htm">הרשמה לייעוץ תזונה ואימונים</a>'
menu3[5]='<a href="http://www.healthnfit.org/modules.php?name=Content&pa=showpage&pid=12">תמיכה בספורטאים</a>'

var menu4=new Array()
menu4[0]='<a href="http://www.healthnfit.org/modules.php?name=Content&pa=showpage&pid=7">כתבות ומאמרים</a>'
menu4[1]='<a href="http://www.healthnfit.org/trainingnutrition/index.htm">תוכניות אימונים ותזונה</a>'
menu4[2]='<a href="http://www.healthnfit.org/blood-test.html">בדיקות דם</a>'
menu4[3]='<a href="http://www.healthnfit.org/modules.php?name=Content&pa=showpage&pid=4">אנטי אייגינג</a>'
menu4[4]='<a href="http://www.healthnfit.org/kishorim/kishorim.html">קישורים שימושיים</a>'
menu4[5]='<a href="http://www.healthnfit.org/kishorim3.htm">קישורים שימושיים 2</a>'


var menu5=new Array()
menu5[0]='<a href="http://www.healthnfit.org/cpg132">גלריית תמונות</a>'
menu5[1]='<a href="http://www.healthnfit.org/galer">גלריית סרטים</a>'

var menuwidth='165px' //default menu width
var menubgcolor='lightpurple' //menu bgcolor
var disappeardelay=250 //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu


Call it myanylink.js and put it in a folder, say:


http://www.healthnfit.org/scripts/

Replace it in the header file with:


<script type="text/javascript" src="http://www.healthnfit.org/scripts/myanylink.js">
/***********************************************
* AnyLink Drop Down Menu- Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>

Make another file called myanylink.css with this in it:


#dropmenudiv{
border-left:1px solid black; border-right:1px solid black; border-top:1px solid black; border-bottom:0px solid black; position:absolute;
line-height:18px;
z-index:100; font-style:normal; font-variant:normal; font-weight:normal; font-size:12px; font-family:Verdana
}

#dropmenudiv a{
width: 100%;
display: block;
text-indent: 3px;
border-bottom: 1px solid black;
padding: 3px 0;
text-decoration: none;
font-weight: bold;
}

#dropmenudiv a:hover{ /*hover background color*/
background-color: yellow;
}

Put it in a folder:


http://www.healthnfit.org/style/

Replace it in the header file with:


<link rel="stylesheet" href="http://www.healthnfit.org/style/myanylink.css" type="text/css">

Genom
09-21-2006, 10:26 PM
I put the files in dropdown folder and linked to the right files
but now its not showing the menu even in html page
this is what I put in the header file:

<link rel="stylesheet" href="http://www.healthnfit.org/dropdown/myanylink.css" type="text/css">
<table class="bodyline" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td align="center" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="60%" height="110" background="themes/phpib2/images/head_bg.gif">
<p dir="ltr"><a href="index.php"><img src="themes/phpib2/images/logo.jpg" border="0" alt="$sitename"></td>
<td width="40%" height="198" background="themes/phpib2/images/head_bg.gif">$showbanners &nbsp;</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#FFFFFF" background="themes/phpib2/images/cellpic1.gif"><table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td width="150" background="themes/phpib2/images/cellpic1.gif" nowrap><font class="content">$theuser</font></td>
<td nowrap><div align="center"><font class="content">
<script type="text/javascript" src="http://www.healthnfit.org/dropdown/myanylink.js">
/***********************************************
* AnyLink Drop Down Menu- &#169; Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
</script></font></div></td>
<td background="themes/phpib2/images/cellpic1.gif" width="150" nowrap><div align="center"><font class="content">
<script type="text/javascript">
<!-- // Array ofmonth Names
var monthNames = new Array( "ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר");
var now = new Date();
thisYear = now.getYear();
if(thisYear < 1900) {thisYear += 1900}; // corrections if Y2K display problem
document.write(now.getDate() + ", "+ monthNames[now.getMonth()] +" " + thisYear);
// -->
</script>
</font></div></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#FFFFFF"><img src="themes/phpib2/images/7px.gif" width="7" height="7"></td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center">
<tr valign="top">
<td>$public_msg<img src="themes/phpib2/images/pixel.gif" width="1" height="1" border="0" alt=""></td>
</tr></table>
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center">
<tr valign="top">
<td valign="top" width="1" background="themes/phpib2/images/7px.gif">



and what do you mean to keep numbered entitles? can you explain please?
thanks

jscheuer1
09-22-2006, 04:19 AM
Get rid of this junk:


#2 Today, 09:57 PM
jscheuer1
Mad Professor Join Date: Mar 2005
Location: SE PA USA
Posts: 7,105



--------------------------------------------------------------------------------

You should probably make the script and style external files. Use this for the script file (you should probably keep the numbered entities, the forum editor converted them to characters):


Code:

from the myanylink.js file.

This:


<script type="text/javascript" src="http://www.healthnfit.org/dropdown/myanylink.js">
/***********************************************
* AnyLink Drop Down Menu- Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>

should probably go right after this in the header file:


<link rel="stylesheet" href="http://www.healthnfit.org/dropdown/myanylink.css" type="text/css">

Genom
09-22-2006, 06:32 AM
still not working
any guess why its not working?
now it doesnt have any errors anymore but cant see the menu?
this is the header file now:
http://www.healthnfit.org/header.html
and this are the scripts:
www.healthnfit.org/dropdown/myanylink.js
www.healthnfit.org/dropdown/myanylink.css

jscheuer1
09-22-2006, 07:42 AM
Why did you take the menu's markup:


<a href="http://www.healthnfit.org/index.php" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu1, '80px')" onMouseout="delayhidemenu()" style="text-decoration: none">
<font color="#000000">פורומים</font></a><font color="#0000FF"><span lang="en-us">&nbsp; </span>&nbsp;</font>|<font color="#0000FF"><span lang="en-us">&nbsp;
</span></font>
<a href="http://www.healthnfit.org/index.php" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu2, '80px')" onMouseout="delayhidemenu()" style="text-decoration: none">
<font color="#000000">מי אנחנו</font></a><font color="#0000FF"><span lang="en-us">
</span></font>&nbsp;|<font color="#0000FF"> </font><b><font color="#0000FF">
<span lang="en-us">&nbsp; </span></font>
<a href="http://www.healthnfit.org/index.php" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu3, '80px')" onMouseout="delayhidemenu()" style="text-decoration: none">
<font color="#008000">ייעוצים</font></a><font color="#0000FF"><span lang="en-us">
</span></font></b><font color="#0000FF">&nbsp;</font>|<font color="#0000FF"><span lang="en-us">
</span>&nbsp;</font><a href="http://www.healthnfit.org/index.php" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu4, '110px')" onMouseout="delayhidemenu()" style="text-decoration: none"><font color="#000000">מאמרים וכתבות</font></a><font color="#0000FF"><span lang="en-us">
</span>&nbsp;</font>|<font color="#0000FF"> <span lang="en-us">&nbsp;</span></font><a href="http://www.healthnfit.org/index.php" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu5, '80px')" onMouseout="delayhidemenu()" style="text-decoration: none"><font color="#000000">גלריות</font></a>

off of the header? Also, you should restore the number entities in the script and markup.

Genom
09-22-2006, 08:26 AM
ok thanks now its working but when I use the menu you can see it only highlights the text how can I do that this yellow will highlight all the box like it needed to and that up and down the borders will go after the text and not only on the text if you know what I mean
and that it will go from right to left or that the inside text will be in the center
and what is number entities? english isnt my primary language
here is the example:
http://www.dynamicdrive.com/forums/attachment.php?attachmentid=561&stc=1&d=1158917797

see the attachment

and I tried to fix it almost fix all the problems but now I tried to use it with phpnuke and its not working...

Genom
09-22-2006, 12:34 PM
ok I fixed all the problems but it still not working with phpnuke
this is the file
http://www.healthnfit.org/header.html

jscheuer1
09-22-2006, 05:37 PM
First, the numbered entities are like:


תזונה בר

When I copied your code into the forum editor, it changed these entities into the characters that they represent, the same way that the browser does. But, they should be used in your code, not the characters themselves.

I think that you are going to need to use these in the head of each page that uses the header as an include (take them off of the header file), ex:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html dir="rtl">
<head>
<title>Untitled Document</title>
<link rel="stylesheet" href="http://www.healthnfit.org/dropdown/myanylink.css" type="text/css">
<script type="text/javascript" src="http://www.healthnfit.org/dropdown/myanylink.js">
/***********************************************
* AnyLink Drop Down Menu- Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>
</head>
<body>
<? code for your include ?>
other code for the body
</body>
</html>

Genom
09-22-2006, 05:52 PM
the menu works good with characters too
and what about that new header page I didnt understand
and also how can I put it in everypage? to put it in the index.php?
I tried to put in the index.php
but then my site wont look good everything will be <center> and it will be a problem for me
is there any other way to fix this problem that it will work with phpnuke? I really need dropdown menu for my site

jscheuer1
09-22-2006, 07:35 PM
If it is only going on one page, just put the script, its style and its markup right on that page.

Genom
09-22-2006, 07:49 PM
index.php using header.html
and everypage in phpnuke uses index.php so what can I do that it will work?
and when I put it in index.php as I said it wont work good

Genom
09-22-2006, 09:19 PM
btw I looked in the codes
and you have index.php that calls in the file header.php that in that file it calls the right theme that I use for the site that in there you have the header.html file

I think you need to know about it
tried to put it there too and still not working

this what I have in the header.php file:


<?php

/************************************************************************/
/* PHP-NUKE: Advanced Content Management System */
/* ============================================ */
/* */
/* Copyright (c) 2002 by Francisco Burzi */
/* http://www.phpnuke.org */
/* Hebrew Translation By HebNukeR Project */
/* http://www.hebnuker.org */
/* Project Administrators E-mail: webmaster@hebnuker.org */
/* Copyright (c) 2003 By Gil Dvir HebNukeR Project Manager */
/* */
/* 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 2 of the License. */
/************************************************************************/

if (eregi("header.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}

require_once("mainfile.php");
if(!eregi("admin.php",$_SERVER['PHP_SELF'])) { require_once("includes/blocker.php"); }


##################################################
# Include some common header for HTML generation #
##################################################

$header = 1;

function head() {
global $slogan, $sitename, $banners, $nukeurl, $Version_Num, $HEBVersion_Num, $artpage, $topic, $hlpfile, $user, $hr, $theme, $cookie, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $textcolor1, $textcolor2, $forumpage, $adminpage, $userpage, $pagetitle;
$ThemeSel = get_theme();
include("themes/$ThemeSel/theme.php");
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
echo "<html dir=\"rtl\">";
echo "<head>\n";
echo "<title>$sitename $pagetitle</title>\n";

include("includes/meta.php");
include("includes/javascript.php");

if (file_exists("themes/$ThemeSel/images/favicon.ico")) {
echo "<link REL=\"shortcut icon\" HREF=\"themes/$ThemeSel/images/favicon.ico\" TYPE=\"image/x-icon\">\n";
}

echo "<LINK REL=\"StyleSheet\" HREF=\"themes/$ThemeSel/style/style.css\" TYPE=\"text/css\">\n\n\n";
include("includes/my_header.php");
echo "\n\n\n</head>\n\n";
themeheader();
}

online();
head();
include("includes/counter.php");
global $home;
if ($home == 1) {
message_box();
blocks(Center);
}

?>

Genom
09-22-2006, 09:56 PM
I forgot to delete the js from the header.html file now its not doing any errors but I still cant see the menu

Genom
09-23-2006, 07:06 PM
so please can anyone help me?

Genom
09-26-2006, 12:06 PM
hello?

Genom
09-29-2006, 09:13 PM
???????????????

Genom
10-03-2006, 10:21 AM
hellllllllllo?