Announcement

Collapse
No announcement yet.

Creating a Section List (With Sub-Sections) in 2 Columns

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

    Creating a Section List (With Sub-Sections) in 2 Columns

    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 col = 1;
    var strIDs = '<table width="100%"><tr><td valign=top width="50%">';
    for (var i=1;i<=ar.length;i++)
    {
    if (ar[i].sURL !=null)
    {
    strIDs += '<a href="' + ar[i].sURL + '"><span class="actxsmall">' + ar[i].sName + '</span></a><br>';
    {
    if (ar[i].pChild)
    {
    for (var j=1;j<=ar[i].pChild.length;j++)
    {
    if (j <= ar[i].pChild.length)
    {
    strIDs += '<a href="' + ar[i].pChild[j].sURL + '"><span class="actxxsmall">' + ar[i].pChild[j].sName + '</span></a><br>';
    }
    }
    }
    }
    if ( col == 1 )
    {
    strIDs += '</td><td valign=top width="50%">';
    col++;
    }
    else
    {
    strIDs += '</td></tr><tr><td valign=top width="50%">';
    col = 1;
    }
    }
    }
    if ( col == 1 ) strIDs += '</td><td>';
    return strIDs + '</td></tr></table>';
    }
    //-->
    </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