Error with converted menus

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
User avatar
simongdawson
Super Advanced
Super Advanced
Posts: 49
Joined: Sun Oct 12, 2003 6:56 am
Location: UK
Contact:

Post by simongdawson »

I have at last sorted things out so that everything (!) is working. See http://www.the-limes.com/milonic5_test.html . In the bottom left hand corner of the screen is a block of stuff all produced by my second menu_data file. It is produced by two php scripts, one javascript, and a linked image from Yahoo Messenger hyperlinked to email me directly.

I have done all the corrections regarding double and missing semicolons, and duplicated blocks, but as you surmised, this was not what was causing the problem.

I renamed menu_data_2.js to menu_data.php. It still works fine, but it allowed me to run php scripts from within it. That incidentally meant I could rename menu_data_1.js to menu_data.js.

I still have no idea why the menu refuses to work in the /java/ directory, but maybe it is because I still have v3 running from there and perhaps there is a conflict. I'll change all of the js calls on my website from the v3 menu to the v5 menu over the next few days and then clear v3 from the website.
Last edited by simongdawson on Wed Oct 22, 2003 8:49 pm, edited 1 time in total.
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Working, apparently - all fixed, not yet (sorry).

The page throws a JS error as soon as it loads - '_tp' is not defined.

I like the borderless style, though. Looks good.
John
User avatar
simongdawson
Super Advanced
Super Advanced
Posts: 49
Joined: Sun Oct 12, 2003 6:56 am
Location: UK
Contact:

Post by simongdawson »

jgillett wrote:Working, apparently - all fixed, not yet (sorry).

The page throws a JS error as soon as it loads - '_tp' is not defined.

I like the borderless style, though. Looks good.
I think that I fixed that a while ago - I suspect you're still seeing a cached page. I'm not getting any errors showing up now at my end. Please let me know if the problem persists. I've changed all the js calls on my website pages to point at the new v5 menu so it is now visible on every page of my website (I hope).
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Cache is clear (in theory, anyway). That's done every morning, but IE doesn't always cooperate.
John
User avatar
simongdawson
Super Advanced
Super Advanced
Posts: 49
Joined: Sun Oct 12, 2003 6:56 am
Location: UK
Contact:

'_tp' is undefined error

Post by simongdawson »

jgillett wrote:Working, apparently - all fixed, not yet (sorry).

The page throws a JS error as soon as it loads - '_tp' is not defined.

I like the borderless style, though. Looks good.
Sometimes the error "'_tp' is undefined" is produced, sometimes it isn't. If it is produced, refreshing the page always clears it. Have you any idea how I can stop this error occuring, please?
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Re: '_tp' is undefined error

Post by John »

simongdawson wrote:Sometimes the error "'_tp' is undefined" is produced, sometimes it isn't. If it is produced, refreshing the page always clears it. Have you any idea how I can stop this error occuring, please?
Not specifically, but here's something I don't like...

Code: Select all

<script language="JavaScript" src="/java/milonic_src.js" type="text/javascript">
</script>
<script language="JavaScript" src="/java/clock.js"></script>...
You're calling clock.js in the middle of calling all of the menu items. Not sure, but I think that might make the menu unhappy.
John
User avatar
simongdawson
Super Advanced
Super Advanced
Posts: 49
Joined: Sun Oct 12, 2003 6:56 am
Location: UK
Contact:

Re: '_tp' is undefined error

Post by simongdawson »

jgillett wrote:You're calling clock.js in the middle of calling all of the menu items. Not sure, but I think that might make the menu unhappy.
That's not it. Until less than 24 hours ago every page on my website had the milonic js calls all listed consecutively. I changed two or three pages yesterday to place clock.js after milonic_src.js to see if it made any difference. It didn't, and I hadn't bothered to change them back again. I have now changed them back. Any other ideas?
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Re: '_tp' is undefined error

Post by John »

simongdawson wrote:Any other ideas?
Yep. The problem is somewhere in the menu_data.php file. I pulled your code down here and still got the failure running against my menu code files. Removing that call stopped the error. Since I'm unable to see the php scripts included in that my guess is the problem is in there.

You might also want to get a doctype in place. Your page just starts with <head>.
John
User avatar
simongdawson
Super Advanced
Super Advanced
Posts: 49
Joined: Sun Oct 12, 2003 6:56 am
Location: UK
Contact:

Re: '_tp' is undefined error

Post by simongdawson »

jgillett wrote: The problem is somewhere in the menu_data.php file. I pulled your code down here and still got the failure running against my menu code files. Removing that call stopped the error. Since I'm unable to see the php scripts included in that my guess is the problem is in there.
You can download the php scripts from http://www.phponline.biz/usersonline/index.php.
jgillett wrote: You might also want to get a doctype in place. Your page just starts with <head>.
I've now been through my website and checked that all pages now have a doctype.

Hope this helps.
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

You should also put a opening <HTML> tag in there. That may help something.

Remove each script one at a time. Take out the clock, see if the errors continues, if so, put clock back in and remove another. Narrow it down to ONE php script thats conflicting with the menu. There may be a variable duplication or conflict somewhere. Get it down to a script then we can go from there...because it definetly sounds like a script conflict from John's comments.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
simongdawson
Super Advanced
Super Advanced
Posts: 49
Joined: Sun Oct 12, 2003 6:56 am
Location: UK
Contact:

Post by simongdawson »

Hergio wrote:You should also put a opening <HTML> tag in there. That may help something.

Remove each script one at a time. Take out the clock, see if the errors continues, if so, put clock back in and remove another. Narrow it down to ONE php script thats conflicting with the menu. There may be a variable duplication or conflict somewhere. Get it down to a script then we can go from there...because it definetly sounds like a script conflict from John's comments.
I've been through my website pages and made sure that they now all have an opening <HTML> tag. (It didn't do anything to help sort the problem, though).

Then I started removing lines from menu_data.php by enclosing them between <!-- and --> (firstly one at a time, and then in various combinations) but to my frustration the only way that I can stop the error occurring is to have all four of the lines removed so that there are no items on the menu. Then I appear not to get the problem. I have left menu_data.php in this state at present in case it helps. Of course, as a result, there is nothing displayed in the bottom left hand corner of my web pages at present (and no _tp error messages!).
User avatar
simongdawson
Super Advanced
Super Advanced
Posts: 49
Joined: Sun Oct 12, 2003 6:56 am
Location: UK
Contact:

Post by simongdawson »

I take it by the long pause that nobody is able to help me. Does this tutorial help? It is a rather beyond me....

http://www.javascriptkit.com/javatutors ... java.shtml
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

I'm not sure that align=centre; will work. Change that to align=center; (but that's not the cause of this problem).

Did you do as Dave suggested - remove the php scripts one at a time from menu_data.php until you find the specific script in there that is causing the problem?
John
User avatar
simongdawson
Super Advanced
Super Advanced
Posts: 49
Joined: Sun Oct 12, 2003 6:56 am
Location: UK
Contact:

Post by simongdawson »

jgillett wrote:I'm not sure that align=centre; will work. Change that to align=center; (but that's not the cause of this problem).
OK. I've changed the offending UK spelling (which incidentally was not recognised by the script).
jgillett wrote:Did you do as Dave suggested - remove the php scripts one at a time from menu_data.php until you find the specific script in there that is causing the problem?
Yes, I did. Please see my reply to him above. I have since removed the <!-- and --> from all the menu items, but as I said above, with menu_data.php displaying four 'active' items (one javascript, two php scripts and a hyperlinked Yahoo Messenger online/offline indicator) it was only by removing all four of the menu items that the _tp error disappeared. Otherwise its occurance is apparently irrational and unpredictable sometimes appearing on a given page and sometimes not, but always when it does occur it is 'cleared' by refreshing the page......

Any ideas?
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

simongdawson wrote:
jgillett wrote:Did you do as Dave suggested - remove the php scripts one at a time from menu_data.php until you find the specific script in there that is causing the problem?
Yes, I did. Please see my reply to him above. I have since removed the <!-- and --> from all the menu items...
I have noticed in ColdFusion that sometimes just putting comment around code does not take it out of the picture - it gets run anyway. I have to remove it entirely from the page. Maybe that's happening here as well.

Note in my reply somewhere above that I was able to run clean by removing just the menu_data.php call. Since we can't see that, please post the entire menu_data.php here. Be sure to enclose it in code tags.
John
User avatar
simongdawson
Super Advanced
Super Advanced
Posts: 49
Joined: Sun Oct 12, 2003 6:56 am
Location: UK
Contact:

Post by simongdawson »

My menu_data.php file reads as follows:

Code: Select all

with(menuStyle2=new mm_style()){
offcolor="#000000";
offbgcolor="#FFFFF0";
oncolor="#000000";
onbgcolor="#FFFFF0";
fontsize="10pt";
fontstyle="normal";
fontweight="normal";
fontfamily="Tahoma, Helvetica, Verdana";
padding=2;
}

with(milonic=new menuname("MainMenu")){
left=10;
itemwidth=150;
screenposition="bottom";
style=menuStyle2;
alwaysvisible=1;
alignment="center";
followscroll=1;

aI("text=<script language='JavaScript'>dT();</script>;url=#;align=left;status=The current time and date in Chalfont St. Peter;");
aI("text=<img border=0 src=http://opi.yahoo.com/online?u=simongoodhughdawson&m=g&t=2>;url=mailto:simon@the-limes.com;align=left;status=Click to email Simon;");
aI("text=<? include($DOCUMENT_ROOT."/online/online.php");?><br>;align=left;status=The number of visitors to the-limes.com currently online;");
aI("text=<? include($DOCUMENT_ROOT."/online/today.php");?><br>;align=left;status=The number of visitors to the-limes.com today;");
}

drawMenus();
I have been playing around as per your suggestion totally removing the various calls in menu_data.php, both singly and in various combinations. As far as I am able to ascertain, the following two calls do not produce the error, either singly or in combination:

Code: Select all

aI("text=<img border=0 src=http://opi.yahoo.com/online?u=simongoodhughdawson&m=g&t=2>;url=mailto:simon@the-limes.com;align=left;status=Click to email Simon;");
aI("text=<? include($DOCUMENT_ROOT."/online/online.php");?><br>;align=left;status=The number of visitors to the-limes.com currently online;");
The other two calls each produce the error.

The clock script reads as follows:

Code: Select all

// Clock Script By Maxx Blade
// http://www.maxxblade.co.uk

// Use the following within your HTML to Start/display your clock
// <script language="JavaScript">dT();</script>

function lZ(x){ return (x>9)?x:'0'+x; }
function tN(){ return new Date(); }
function wT(){ x=new Date(tN().getUTCFullYear(),tN().getUTCMonth(),tN().getUTCDate(),tN().getUTCHours(),tN().getUTCMinutes(),tN().getUTCSeconds()); x.setTime(x.getTime()+daysave()+tZo); return x; }
function lmT(){ return new Date(document.lastModified); }
function fY(x){ return (x<500) ? x+1900 : x; }
//function hr12(x){ ap=(x>11)?' PM':' AM'; if(x==0){ x=12 } return (x>12)?x-=12:x; }
//function eD(x){ if(x==1||x==21||x==31){ return 'ST'; } if(x==2||x==22){ return 'nd'; } if(x==3||x==23){ return 'rd'; } return 'th'; }
function dT(){
	if(fr==0){ fr=1; document.write('<font size="3"></font>UK Time<br><span id="ts" >'+eval(cTt)+'</span></font><br>'); document.write('<font size="3"></font>'+eval(tTt)+'</font>'); }
	if(!ns4){ with(eval(tsd)){ innerHTML=eval(cTt); } }
	clockTO=setTimeout('dT()',1000);
}
function fDay(d,m,h,p){
	var week=(p<0)?7*p:-7*(p-1),nm=(p<0)?m+1:m,tD=new Date(tN().getUTCFullYear(),nm,1,h,0,0);
	if(p<0){ tD.setTime(tD.getTime()-da1); }
	if(tD.getDay()!=d){ dOff=(tD.getDay()<d)?(d-tD.getDay()):(tD.getDay()-d); tD.setTime(tD.getTime()+((dOff+week)*da1)); }
	return tD;
}
function daysave(){ return ( ( tN().getTime()>fDay(0,2,1,-1).getTime() ) && ( tN().getTime()<fDay(0,9,1,-1).getTime() ) ) ? 3600000 : 0; }
var ns4=(document.layers)?1:0,ie4=(document.all)?1:0,ns6=(document.getElementById&&!document.all)?1:0,tsd=(ns6)?"document.getElementById('ts')":"document.all['ts']",thetitle=document.title,da1=86400000,tZo=0,fr=0,ap,dN=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'),mN=new Array('January','February','March','April','May','June','July','August','September','October','November','December'),tTt="dN[wT().getDay()]+' '+wT().getDate()+'<br>'+mN[wT().getMonth()]+' '+fY(wT().getYear())",cTt="lZ(wT().getHours())+':'+lZ(wT().getMinutes())+':'+lZ(wT().getSeconds())",dLm="dN[lmT().getDay()].substring(0,3)+' '+lmT().getDate()+(lmT().getDate())+' '+mN[lmT().getMonth()].substring(0,3)+' '+fY(lmT().getYear())+' @ '+lZ(lmT().getHours())+':'+lZ(lmT().getMinutes())";
The 'Users Today' script can be downloaded free from http://www.phponline.biz/usersonline/index.php (I have not reproduced its content here because although it is a free script, it states in its headers that 'This software/script should not be copied, modified or distributed in any form.').
User avatar
simongdawson
Super Advanced
Super Advanced
Posts: 49
Joined: Sun Oct 12, 2003 6:56 am
Location: UK
Contact:

Post by simongdawson »

I've just been checking the site on my laptop (as opposed to my PC which I was using when I last posted). The other two calls are producing the error as well now. Both my laptop and PC are set to delete all Temporary Internet Files when IE6 is closed and I have been closing it (and FrontPage) each and every time I try deleting and then checking a call.

I don't know if it makes any difference, but when I have been clicking around to see if the error occurs it is usually (but not always) on php dynamically produced pages (because most of the pages on my website are produced this way).
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

BTW, you have two menus with the same name. You have a menu defined in your menu_data.js called MainMenu and a menu defined in your menu_data.php called MainMenu. Definetly change that up.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
simongdawson
Super Advanced
Super Advanced
Posts: 49
Joined: Sun Oct 12, 2003 6:56 am
Location: UK
Contact:

Post by simongdawson »

Hergio wrote:BTW, you have two menus with the same name. You have a menu defined in your menu_data.js called MainMenu and a menu defined in your menu_data.php called MainMenu. Definetly change that up.
Right. I've just changed that. MainMenu in menu_data.js is now TopMenu and MainMenu in menu_data.php is now BottomMenu.

I still have the _tp error......
User avatar
simongdawson
Super Advanced
Super Advanced
Posts: 49
Joined: Sun Oct 12, 2003 6:56 am
Location: UK
Contact:

Post by simongdawson »

It may be (!) that I have sorted out the infernal _tp error......
bzeitner wrote: Also, the following code, at the top of each file, only needs to be declared once for each page. Keep it in the first menu you call. Otherwise, you're just wasting space.

Code: Select all

_menuCloseDelay=500;
_menuOpenDelay=150;
_scrollAmount=3;
_scrollDelay=20;
_followSpeed=5;
_followRate=40;
_subOffsetTop=4;
_subOffsetLeft=6;
I had done as bzeitner recommended and had the _tp error. I have today deleted the above block of code from menu_data.js and inserted it instead in the second menu I call, i.e. menu_data.php. I would appreciate it if anyone tells me if I am still producing the _tp error on any page at http://www.the-limes.com .
Post Reply