Announcement

Collapse
No announcement yet.

Child Section Listing with NETQUOTEVAR:CHILDSECTIONS

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

    Child Section Listing with NETQUOTEVAR:CHILDSECTIONS

    Hi all,

    Keep hitting a brick wall with this one, which maybe someone has come across before, or basically point out the obvious or something.

    I have the root page showing all of the Top Level Sections in image form only and want to populate text links underneath the image with a list of the sub-sections it contains.

    Looked through and tried playing with the many scripts from the Adv U Guide, but I dont seem to be able to get just the child sections for each particular sub-section only....

    Anyone got any ideas.

    Thanks....

    #2
    I've just added some code to the latest AUG which might help. In teh Javascript section lists bit, there is now a section on 'Creating a List of Hyperlinks with Sections and Sub-sections'.

    What I'm thinking is you could probably replace the JavaScript line for the top level section link i.e.

    Code:
    strIDs += '<tr><td colspan=2><a href="' + ar[i].sURL + '"><span class="actxxsmall">' + ar[i].sName + '</span></a></td></tr>';
    with some code nicked from the section on creating an image list i.e.

    Code:
    strIDs += '<tr><td colspan=2><a href="' + ar[i].sURL + '"><img src="' + pItem[i].sImage + '" alt="'+ pItem[i].sName + '" width=' + pItem[i].nImageWidth + ' height=' + pItem[i].nImageHeight + ' border=0></a></td></tr>';
    Hope this gives some pointers.

    Comment


      #3
      Gave it a try but created a mountain of errors with section not defined and all that stuff...

      I think I am probably going about this the wrong way, so will have to look at an alternative solution.

      On another one, would be good to get the scripts "CHILDSECTIONS_RAW" to be able to generate a list of its own child sections within the current section, but my head is just not getting around this lot today, infact hasnt been getting around it for a few days lol...

      Such is.

      Thanks,

      Comment


        #4
        Probably did not help that my code was wrong...

        Put this code into your headers under the line that reads:
        <SCRIPT LANGUAGE="JavaScript" SRC="actinicextras.js" TYPE="text/javascript"></SCRIPT>

        Code:
        <!--@act NETQUOTEVAR:SECTIONTREE_RAW -->
        
        <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 += '<tr><td colspan=2><a href="' + ar[i].sURL + '"><img src="' + ar[i].sImage + '" alt="'+ ar[i].sName + '" width=' + ar[i].nImageWidth + ' height=' + ar[i].nImageHeight + ' border=0></a></td></tr>';
        {
        if (ar[i].pChild)
        {
        for (var j=1;j<=ar[i].pChild.length;j++)
        {
        if (j <= ar[i].pChild.length)
        {
        strIDs += '<tr><td><img src=shim.gif width=5></td><td><a href="' + ar[i].pChild[j].sURL + '"><span class="actxxsmall"><font color=white>' + ar[i].pChild[j].sName + '</font></span></a></td></tr>';
        }
        }
        }
        }
        }
        }
        strIDs += '</table>' 
        return strIDs
        }
        //-->
        </SCRIPT>
        Then in the main body of the page, enter the following where you want the list to appear.

        Code:
        <script language=Javascript1.1>document.write(SectionList(section_tree))
        </script>
        The images don't appear in a preview (unless you copy them to the 'PreviewHTML' folder) but they work fine online.

        Comment


          #5
          Hi Chris,

          Tried that, but did not seem to do the trick, no worries though, have gotten around it by using customvar's and manually entering the page urls, which works well and allows better formatting and usage of descriptive names/titles.

          Am however still having problems getting a list of child sections listed from usage of the java scripts and netquotevars. eg:

          <!--@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 += '';
          {
          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> | ';
          }
          }
          }
          }
          }
          }
          strIDs += ''
          return strIDs
          }
          //-->
          </SCRIPT>

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

          This code produces a list of all of the child sections from the entire site, but how do I go about getting it to only show the child sections from the current section that it is being called from?

          Anyone goy any ideas on this one...

          Thanks

          Comment


            #6
            Right then, following on from my previous post on this subject I have come up with something which although very nasty in design, does the trick nicely.

            <!--@act NETQUOTEVAR:CHILDSECTIONS_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 += '<a href="' + ar[i].sURL + '">' + ar[i].sName + '</a> | ';
            {
            if (ar[i].pChild)
            {
            for (var j=1;j<=ar[i].pChild.length;j++)
            {
            if (j <= ar[i].pChild.length)
            {
            strIDs += '';
            }
            }
            }
            }
            }
            }
            strIDs += ''
            return strIDs
            }
            //-->
            </SCRIPT>


            ### Inserted Where I want it to show ###
            <script language=Javascript1.1>document.write(SectionList(child_sections))
            </script>

            It can do with loads of cleaning up and removal of the non-required stuff, but for now it works and that is the main thing.

            Thanks all for the advice on this one..

            Back to work.....

            Comment

            Working...
            X