Scriptlet headers being loaded multiple times

Store UI, layout, design, look and feel; Discussion on the customer facing pages of your online store. Cascading Style Sheets, Themes, Scriptlets, NVelocity and the components in the ConLib directory.
Post Reply
mouse_8b
Commander (CMDR)
Commander (CMDR)
Posts: 115
Joined: Mon Oct 11, 2010 1:21 pm
Location: Austin, TX
Contact:

Scriptlet headers being loaded multiple times

Post by mouse_8b » Mon Oct 11, 2010 2:04 pm

Hello,
I'm relatively new to AbleCommerce, but i think I've got most of it figured out. My problem today deals with HTML headers in scriptlets. My right sidebar has a header that consists of some CSS and some javascript (each in their respective style and script tags). After I set my home page to use my right sidebar (using the controls at the bottom of the site), the header section of the right sidebar scriptlet has made it to the source code twice.

Code: Select all

<style type="text/css">
#localInfo{
    display: block;
}

#deliveryArea{
    display: none;
}
</style>
<script type="text/javascript">
    window.onload=init;
    
    var showing, hidden;
        function init(){
        showing = document.getElementById("localInfo");
        hidden = document.getElementById("deliveryArea");
        
        setTime();
    }
    
    function changeSidebar(){
        showing.style.display = "none";
        hidden.style.display = "block";
        
        var temp = showing;
        showing = hidden;
        hidden = temp;
        
        setTime();
    }
    
    function setTime(){
        var timing = setTimeout("changeSidebar()", 2000);
    }
</script><style type="text/css">
#localInfo{
    display: block;
}

#deliveryArea{
    display: none;
}

</style>
<script type="text/javascript">
    window.onload=init;
    
    var showing, hidden;
        function init(){
        showing = document.getElementById("localInfo");
        hidden = document.getElementById("deliveryArea");
        
        setTime();
    }
    
    function changeSidebar(){
        showing.style.display = "none";
        hidden.style.display = "block";
        
        var temp = showing;
        showing = hidden;
        hidden = temp;
        
        setTime();
    }
    
    function setTime(){
        var timing = setTimeout("changeSidebar()", 2000);
    }
</script>
Further, when I turn on the left sidebar, all hell breaks loose. I won't quote the source code as it is when the browser gets it, as that would be very long and tedious to look through, but in a nutshell, the headers are in the order:
  • Layout, Store Header, Store Home Page, Right Sidebar, Right Sidebar, Layout, Store Header, Left Sidebar, Store Home Page, Right Sidebar, Left Sidebar, Right Sidebar
What is with all of the duplications? I have checked the scriptlets, no extra copies in the headers. Default.aspx doesn't seem to have anything to do with it either.

I have noticed these duplications in the past, but they have not seemed to affect the page. Today I wanted to add the javascript functionality you see above, but it is not working on the live site. The duplications may not have anything to do with my javascript not working, but I'm not sure. Any info or tips?

Post Reply