Announcement

Collapse
No announcement yet.

Creating a List of Hyperlinks with Sections and Two Levels of Sub-sections

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

    Creating a List of Hyperlinks with Sections and Two Levels of Sub-sections

    This code will lay out your sections and two levels of sub-sections within a list of hyperlinks. The sub-sections will appear indented.

    Paste the following code just above the </head> tag in your overall page layout:

    HTML Code:
    <actinic:variable value="All Data From All Sections" name="JavaScriptArray" />
    
    <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
    <!--
    function SectionList(ar)
    {
    var strIDs = '<table border=0 width=95% cols=2>';
    for (var i=1;i<=ar.length;i++)
      {
      if (ar[i].sURL !=null)
        {
        strIDs += '<table><tr><td colspan=2><a href="' + ar[i].sURL + '"><span class="actxxsmall">' + ar[i].sName +  '</span></a></td></tr></table>';
          {
          if (ar[i].pChild)
            {
            for (var j=1;j<=ar[i].pChild.length;j++)
              {
    strIDs += '<table><tr><td><img src=shim.gif width=5></td><td><a href="' + ar[i].pChild[j].sURL + '"><span class="actxxsmall">' + ar[i].pChild[j].sName + '</span></a></td></tr></table>';         
    
                {
                if (ar[i].pChild[j].pChild)
                  {
                  for (var k=1;k<=ar[i].pChild[j].pChild.length;k++)
                    {
    
      strIDs += '<table><tr><td width="20"></td><td><a href="' + ar[i].pChild[j].pChild[k].sURL + '"><span class="actxxsmall">' + ar[i].pChild[j].pChild[k].sName + '</span></a></td></tr></table>';
    
                    }
                  }
                }
              }
            }
          }
        }
      }
    strIDs += '</table>'
    return strIDs
    }
    //-->
    </SCRIPT>
    and this bit to go into the main body:

    HTML Code:
    <script language=Javascript1.1>document.write(SectionList(section_tree))
    </script>
    For more information about creating section lists with javascript see this article
Working...
X