JavaScript.CoolDev.Com Support Forums

Any questions related to JavaScript menu and JavaScript tree menu by Javascript.CoolDev.Com

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

RedrawAllTrees() in an included file...

 
Post new topic   Reply to topic    JavaScript.CoolDev.Com Forum Index -> COOLjsTree
Author Message
RickerOne



Joined: 13 Aug 2003
Posts: 3
Location: Chicago

PostPosted: Wed Aug 13, 2003 2:50 pm    Post subject: RedrawAllTrees() in an included file... Reply with quote

Hello:

I was wondering if there was anyway to add the RedrawAllTrees() in an included file using a php include instead of putting it in the body tags.

The reason I want to do this is so I so I don't have to put the RedrawAllTrees() code on EVERY page I create.

I have the tree.init() code inside of a <? include("tree.php");?> and I wanted to put the RedrawAllTrees() inside of <? include("footer.php");?>. These include files are inside of a <TABLE> that defines the layout of the site (the header, nav, main, and footer are all within <TD> tags).

This works fine, except that when I load the page, all of the tree nodes are drawn on top of each other.

Any ideas?
Back to top
Gala
Support Team


Joined: 21 Jul 2003
Posts: 12

PostPosted: Wed Aug 13, 2003 9:13 pm    Post subject: Reply with quote

Hello!

This problem exists because of wrong initialization sequence. It will be better if you'll include RedrawAllTrees() just before the </BODY>, or there is another way - you can write <BODY onload="RedrawAllTrees()">

Good luck!
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Wed Aug 13, 2003 9:17 pm    Post subject: Reply with quote

Also, it will be not so bad idea to include following code to your template:
Code:
<body ... onload="if (RedrawAllTrees) RedrawAllTrees()">

This code will safely call RedrawAllTrees, and if some page just does not use cooltreepro.js, this will not cause errors. 40 spare bytes on every page, but much less headache. Also, in your tree_nodes.js file you can write the following:
Code:
window.onload = RedrawAllTrees;

If this will work, then you will not have to modify your template.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    JavaScript.CoolDev.Com Forum Index -> COOLjsTree All times are GMT
Page 1 of 1