Categories > TinyButStrong general >

Onload file loads file twice on displayed page

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Don Bledsoe
Date: 2009-03-26
Time: 19:17

Onload file loads file twice on displayed page

In my <head> tag I have this: [onload;file=tpl/menu_inlinestyle.html] ... it loads perfectly, inserting this:
<style type="text/css" media="screen">
body{ behavior:url("csshover2.htc"); }
.pd_menu_01 {float:left; padding:0; margin:0;color: #1F1B2B;background: #A0CDAF;width:100%; border:solid 1px #004080;clear:both;} /*Color navigation bar normal mode*/
.pd_menu_01  a, .pd_menu_01 a:visited {
font-family:Verdana, Arial, Helvetica, sans-serif;
font-style:normal;
font-weight:bold;
font-size:11px;
color: #1F1B2B;
background-color: #A0CDAF;
text-decoration: none;
}
.pd_menu_01 ul {list-style-type:none;padding:0; margin:0;}
.pd_menu_01 ul li {float:left; position:relative; z-index:auto !important ; z-index:1000 ; border-right:solid 1px #004080; border-left:solid 1px #004080;}
.pd_menu_01 ul li a {color: #1F1B2B;background: #A0CDAF;float:none !important ; float:left ; display:block; height:30px; line-height:30px; padding:0 10px 0 10px; text-decoration:none; }
.pd_menu_01 ul li ul {display:none; border:none;color: #1F1B2B;background: #A0CDAF; width:1px}
.pd_menu_01 ul li:hover a {background-color:#236071; text-decoration:none; color:#FFFFFF;} /*Color main cells hovering mode*/
.pd_menu_01 ul li:hover ul {display:block;  position:absolute; z-index:999; top:29px; margin-top:1px; left:0;}
.pd_menu_01 ul li:hover ul li a {display:block; width:160px; height:auto; line-height:1.3em; margin-left:-1px; padding:5px 10px 5px 10px; border-left:solid 1px #004080; border-bottom: solid 1px #004080; background-color:#A0CDAF;  color:#1F1B2B;} /*Color subcells normal mode*/
.pd_menu_01 ul li:hover ul li a:hover {background-color:#236071; text-decoration:none;color:#FFFFFF;} /*Color subcells hovering mode*/
.pd_menu_01 ul li a:hover {background-color:#236071; text-decoration:none;color:#FFFFFF;} /*Color main cells hovering mode*/
.pd_menu_01 ul li a:hover ul {display:block; width:160px; position:absolute; z-index:999; top:29px; left:0; }
.pd_menu_01 ul li ul li a:visited { background-color:#A0CDAF;  color:#1F1B2B;} /*Color subcells normal mode*/
.pd_menu_01 ul li a:hover ul li a {display:block; width:160px; height:1px; line-height:1.3em; padding:4px 16px 4px 16px; border-left:solid 1px #004080; border-bottom: solid 1px #004080; background-color:#A0CDAF;  color:#1F1B2B;}
.pd_menu_01 ul li a:hover ul li a:hover {background-color:#236071; text-decoration:none;color:#FFFFFF;} /*Color subcells hovering mode*/
</style>

In my <body> tag I have this: [onload;file=tpl/navigation.html] ... it loads perfectly, inserting this:
<div class="pd_menu_01 ">
<ul><li><a href="index.php">Home</a>
</li></ul>

<ul><li><a href="#">Film, TV & Video Projects</a>
<ul>
<li><a href="castingcouch.php"  >Casting Couch</a></li>
<li><a href="hasbeen.php"  >Hasbeen Hotel</a></li>
<li><a href="mam.php"  >Mud Alley Midgets</a></li>
<li><a href="queendad.php"  >Queen Dad</a></li>
<li><a href="stainedg.php"  >Stained Glass</a></li>
</ul>
</li></ul>

<ul><li><a href="#">Theatrical Projects</a>
<ul>
<li><a href="nunsingular.php"  >Nun Singular Sensation</a></li>
<li><a href="laramie.php"  >The Laramie Project</a></li>
<li><a href="yes.php"  >Youth Ensemble Space</a></li>
</ul>
</li></ul>

<ul><li><a href="about.php">About Us</a>
</li></ul>

<ul><li><a href="#">Contact Us</a>
<ul>
<li><a href="mailto:seanmoran@xxxxxx.com?SUBJECT=Website Inquiry"  >Email >> Sean Moran</a></li>
<li><a href="mailto:donbledsoe@xxxxxx.com?SUBJECT=Website Inquiry"  >Email >> Don Bledsoe</a></li>
</ul>
</li></ul>
</div>

THIS PROBLEM IS: Both blocks are duplicated at the very top of the page ... is reversed order from how they are listed in the template file and shown above. Otherwise, it works flawlessly. How do I stop the duplication?
By: Don Bledsoe
Date: 2009-03-26
Time: 20:04

Re: Onload file loads file twice on displayed page

I figured it out ... I reduced everything down into single, loadable blocks, like: [onload;file=tpl/header.html]

It turned out the duplicate entries were being caused by entries in the php file. Once the variable references were removed from there, the duplicates vanished and it works perfectly.

Now, key items like the navigation menu (which is being updated often) or the page header, can be updated in a single file, making my life much easier.