Announcement

Collapse
No announcement yet.

dynamic list of sub-sections only

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

    dynamic list of sub-sections only

    Hi, currently I am using a javascript (SectionList function) to create a dynmaic list of all sections and sub-sections.

    This works great, but what I really want to do is just list the sub-sections in one section, not all sections.

    Is there a way to do this either by adapting the current javascript or some other way all together?

    Thanks in advance, K.

    Current Javascript:

    in BODY:
    <script language=Javascript1.1>document.write(SectionList(section_tree))</script>

    In HEAD:
    Code:
    <!--@act NETQUOTEVAR:SECTIONTREE_RAW -->
    <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
    <!--
    function SectionList(ar)
    {
    var strIDs = '';
    for (var i=1;i<=ar.length;i++)
      {
      if (ar[i].sURL !=null)
        {
        strIDs += '<HR noshade size="1" width="90%" align="center"><strong><a class="SectionTop" href="' + ar[i].sURL + '">' + ar[i].sName +  '</a></strong><BR>';
          {
          if (ar[i].pChild)
            {
            for (var j=1;j<=ar[i].pChild.length;j++)
              {
    strIDs += '<em><a class="SectionChild" href="' + ar[i].pChild[j].sURL + '">' + ar[i].pChild[j].sName + '</a></em><BR>';          
     
                {
                if (ar[i].pChild[j].pChild)
                  {
                  for (var k=1;k<=ar[i].pChild[j].pChild.length;k++)
                    {
     
      strIDs += '<a class="SectionChildChild" href="' + ar[i].pChild[j].pChild[k].sURL + '">' + ar[i].pChild[j].pChild[k].sName + '</a><BR>';
     
                    }
                  }
                }
              }
            }
          }
        }
      }
    strIDs += '' 
    return strIDs
    }
    //-->
    </SCRIPT>

    #2
    Hi Kris

    If I understood the query correctly, you wish to only display the sub-sections within a section. If yes, you could try the following work-around which will generate a drop-down list of the sub-sections within a parent section :

    Edit the primary template and rename it if you wish to use this workaround for only some sections.

    Code:
    In the primary template :
    
    - uncomment the following lines in the HEAD part:
    
    NETQUOTEVAR:CHILDSECTIONS_NAMES
    NETQUOTEVAR:CHILDSECTIONS_URLS
    
    Add the following lines into the <HEAD> section 
    
    <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">[/HTML]<!--
    /*********************************************************
    
    * ACT_DropLBChild -     returns a string containing the HTML for the 
    SELECT listbox[/QUOTE]*
    ************************************************************************/
    
    function ACT_DropLBCHild(arn, aru)
            {
            var strIDs = '<SELECT SIZE="1" NAME="ACT_droplbchild" onChange="if(options[selectedIndex].value) window.location.href=(options [selectedIndex].value)">'
            var sel = " SELECTED"
            strIDs += '<OPTION ' + sel + ' VALUE="">Select a Section</OPTION>'
            for (var i=1;i<=arn.length;i++)
                    {
                    if (aru[i].sURL !=null)
                            {
         strIDs += '<OPTION VALUE="' + aru[i].sURL +  '&NOCLEARFRAMES=1">' + arn[i].sName + '</OPTION>'
                            }
                    }
            strIDs+='</SELECT>'
            return strIDs
            }//-->
    </SCRIPT>
    
    - Paste the following lines in the <BODY> portion of the template where the list should appear:
    
       <form name="Act_ChildSectionDroplist">
    valign="middle" align="center">
            <script language=Javascript1.1>
            <!--
            document.write(ACT_DropLBCHild(child_sections_names, 
    child_sections_URLs))
            // -->
            </script>
            </form>
    -Now upload the site and view the changes.

    Hope this helps.
    Krithika Chandrasekar
    SellerDeck

    sigpic

    E-commerce software by SellerDeck

    Comment


      #3
      Sorry for the delay in replying... I have not yet tried what you suggested, but thanks very much. Its looks just what I am after!

      Comment

      Working...
      X