Announcement

Collapse
No announcement yet.

Act_section_tree

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Act_section_tree

    I know I've brought this up before, but since I'm back to working with Actinic (and since we've been gifted this great new board), I thought I'd flag it up again.

    Currently, scripts make up the majority of our page size. An average page has about 544Kb of scripts, a figure dwarfing the combined size of the page's images. The culprit of this is Act_section_tree and its bloated progeny, and much of this is unnecessary.

    For example, the first few lines of our Act_section_tree_names.js reads as follows:

    Code:
    var section_tree_names = new CreateArray(40);
    section_tree_names[1].sName = "Apple";
    section_tree_names[1].pChild= new CreateArray(6);
    section_tree_names[1].pChild[1].sName = "Apple compatible laser printer supplies";
    section_tree_names[1].pChild[2].sName = "Apple Stylewriter I / II / 1200 printer";
    Which could be neatly trimmed thus:

    Code:
    var a = new CreateArray(40);
    a[1].sName = "Apple";
    a[1].pChild= new CreateArray(6);
    a[1].pChild[1].sName = "Apple compatible laser printer supplies";
    a[1].pChild[2].sName = "Apple Stylewriter I / II / 1200 printer";
    Which, of itself, is not much of a saving. But multiplied by the number of sections on the site and it becomes a huge reduction. It does result in a variable with a useless name, but I feel this is justified in this particular case.

    Act_section_tree_URLSs.js is an even worse offender. Again, taking an example from our site:

    Code:
    var section_tree_URLs = new CreateArray(40);
    
    section_tree_URLs[1].sURL = "http://www.ourratherlongurl.co.uk/cgi-bin/ss000099.cgi?SECTIONID=Apple%5fPrinter%5fSupplies%2ehtml&NOLOGIN=1";
    section_tree_URLs[1].pChild= new CreateArray(6);
    section_tree_URLs[1].pChild[1].sURL = "http://www.ourratherlongurl.co.uk/cgi-bin/ss000099.cgi?SECTIONID=copy%5fof%5fApple%5fcompatible%5flaser%5fprinter%5fsupplies%2ehtml&NOLOGIN=1";
    section_tree_URLs[1].pChild[2].sURL = "http://www.ourratherlongurl.co.uk/cgi-bin/ss000099.cgi?SECTIONID=Stylewriter%5fI%5f%5f%5fII%5f%5f%5f1200%2ehtml&NOLOGIN=1";
    This thing is huge. It's the single largest element on any of our pages ,and most of it is completely redundant. Some simple editing gets it down to this:

    Code:
    b = new CreateArray(40);
    
    u = "http://www.ourratherlongurl.co.uk/cgi-bin/ss000099.cgi?SECTIONID="
    l = "%2ehtml&NOLOGIN=1"
    
    b[1].sURL = u+"Apple%5fPrinter%5fSupplies"+l;
    b[1].pChild= new CreateArray(6);
    b[1].pChild[1].sURL = u+"copy%5fof%5fApple%5fcompatible%5flaser%5fprinter%5fsupplies"+l;
    b[1].pChild[2].sURL = u+"Stylewriter%5fI%5f%5f%5fII%5f%5f%5f1200"+l;
    This is a dramatic reduction. Getting rid of line breaks, whitespace and anything else that's not needed would further reduce the size. These files never need to be read by a human, so making them readable is pointless.

    Another solution (although an unlikely one) would be to use AJAX to get the information. File size is a much more precious commodity than the client's processing power, and doing it this way will allow the page to load gradually rather than having to take that huge initial hit.

    This seems to be a pretty simple fix to me, and would be a huge benefit to us and anyone else using the section_tree files for anything.

    Thanks.

    #2
    I would second this as many problems have been caused by the section tree so any way of reducing it will be very usefull

    Comment


      #3
      Sorry for the bump, but this is still a pretty big issue for us. It would be great if Actinic could take a look at it.

      Comment


        #4
        I posted an almost identical suggestion for compacting Act_section_tree.js
        over 3 years ago!

        To get round these huge files I wrote a PHP program that runs on the server and strips this file down to minimal size as well as removing redundant entries (like the section image def's). The resulting file is usually one fifth the original size. To reduce server load, the script creates a new stripped_section_tree.js (it only does this once if it finds the Act_sections_tree.js is newer than the stripped copy).

        However, now we've V8 you can do a lot with the Site Map layout to create compact section structures. See http://www.drillpine.biz/v8norlist/ where the dynamic menu is actually a search engine friendly Site Map set of UL items.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Hi Rob

          I would suggest having a look at the 'Advanced List Functionality' that's in the Advanced User Guide for v8.

          It enables you to create simple custom lists of store data without having to use javascript or create new layouts. e,g, here is the code for a jump list in v8...

          http://community.actinic.com/showthread.php?t=26347

          Comment

          Working...
          X