Announcement

Collapse
No announcement yet.

Current Top level section ID or Name

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

    Current Top level section ID or Name

    I'm using the YahooSections type menu and would like to have the top level section button to be highlighted when in the section or sub sections there of.

    What is required is a unique identifier for the section that is availible in that secton and its child subsections.

    I've looked through all of the JS arrays and cant find a var to suit.

    Normally I would do this via an If Statement in ASP using the URL and a variable in each item of the menu, but obviously thats out and JS has to be the way as the site needs to be dynamic enough to recognise the new sections being added.

    I'd be really grateful for help if any one has any ideas or has done this before please shout out

    Thanks
    Justin Rowe
    Shiver

    #2
    One idea would be to use some JS inside the Act_ParentSectionsThis.html file to put the name of the section into a variable, before using it to compare against the names of child sections when looping through YahooSections()?
    www.gbradley.co.uk
    Web Development, Actinic Patches, Scripts & more

    Comment


      #3
      Thanks Graham, I take a look at that.

      Has any body ever done this before?
      Justin Rowe
      Shiver

      Comment


        #4
        Will NETQUOTEVAR:SECTIONNAME work in the head of the primary template, i.e. does it not need to come before or in the YahooSections Javascripting?
        Justin Rowe
        Shiver

        Comment


          #5
          Looks like NETQUOTEVAR:SECTIONNAME can't be accessed from the primary template. You could create a function that was triggered with <BODY onload="...">, which would run through the section tree and alter the style/class of the text when the right section was found.

          Sounds like a bit of effort for a small reward, there must be a simpler way but i can't think of one at the moment
          www.gbradley.co.uk
          Web Development, Actinic Patches, Scripts & more

          Comment


            #6
            Yeah that sounds like it would work nicely, it's just getting the section flagged up
            Justin Rowe
            Shiver

            Comment


              #7
              We had a thread back in (December?) which dealt with showing the section tree for only the current section (i.e. the one section page and its sub-section pages). This required a return to the top catalog page to explore each branch, but might help with your problem.
              Bill
              www.egyptianwonders.co.uk
              Text directoryWorldwide Actinic(TM) shops
              BC Ness Solutions Support services, custom software
              Registered Microsoft™ Partner (ISV)
              VoIP UK: 0131 208 0605
              Located: Alexandria, EGYPT

              Comment


                #8
                Thanks for your reply, unfortunately we're not after a DHTML type hover menu. We've played with Normans menus already and although very functional don't really fit the bill.

                We basically want to write a class into the current top level section to show the current sub sections and hide the remaining sub sections through css. Its a very simple and light weight solution.

                Its just a matter of getting the top level section into the page and assigning it to the correct section in the menu.

                The problem arises with us being unable to find a section identifier at the top level section level that is also available when in the child sections specific to to the individual parent section.

                Sorry to ramble.
                Justin Rowe
                Shiver

                Comment


                  #9
                  Oh, that was not a hover menu. The thread I was remembering was in fact from October and the solution given was for a dropdown list of pages within the current section. I also found this http://community.actinic.com/showthr...n+list+current which suggests use of a bulleted section list.

                  These are both javascript solutions.
                  Bill
                  www.egyptianwonders.co.uk
                  Text directoryWorldwide Actinic(TM) shops
                  BC Ness Solutions Support services, custom software
                  Registered Microsoft™ Partner (ISV)
                  VoIP UK: 0131 208 0605
                  Located: Alexandria, EGYPT

                  Comment


                    #10
                    Thanks William, I'll take a look and hopefully it will be what we're after.
                    Justin Rowe
                    Shiver

                    Comment


                      #11
                      I now have a way of doing this very effectively by the use of a CUSTOMVAR (section name) and a minor edit to the Yahoo style JS.

                      I don't want to upset any one by posting it here, but please get in touch and I'll get back to you.

                      Or if you guys don't mind I'm happy to throw it up for all, its actually very simple.
                      Justin Rowe
                      Shiver

                      Comment


                        #12
                        Originally posted by shiver
                        I now have a way of doing this very effectively by the use of a CUSTOMVAR (section name) and a minor edit to the Yahoo style JS.

                        I don't want to upset any one by posting it here, but please get in touch and I'll get back to you.

                        Or if you guys don't mind I'm happy to throw it up for all, its actually very simple.
                        Hi,
                        Did this method just include child sections or did it also include all sections within the particular section even if you were in a 'child section'?

                        Folk

                        Comment


                          #13
                          I'm using the YahooSections type menu and would like to have the top level section button to be highlighted when in the section or sub sections there of.
                          Here's my replacement for the YahooSections code that detects whether you're in a particular section (or it's child) when writing out the top-level names.

                          This demo just places an "X" against the current active top-level item. This code is for guidance only. It won't work (although probably is easy to amend) for Business logged-in customers or pages returned via the Search Highligh script.
                          Code:
                          <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
                          <!--
                          thispage = location.pathname.replace(/.*acatalog\//,'');  // get the page name part of URL
                          
                          function inchildsection(sect){		// return whether this page or it's children match current page
                            if ( unescape(sect.sURL.replace(/.*SECTIONID=(.*)&NOLOGIN=.*/,"$1")) == thispage ) return true;
                            if ( sect.pChild )					  // if child sections 
                              {
                              for ( var i=1; i <= sect.pChild.length; i++ )	  // try all children
                                { 
                                if ( inchildsection(sect.pChild[i]) ) return true;  // recursively
                                }
                              return false;
                              }
                            return false; 
                          }
                          
                          function YahooSections(ar)
                          {
                          var strIDs = '';
                          for (var i=1;i<=ar.length;i++)
                            {
                            if (ar[i].sURL != null)
                              {
                              var highlight = inchildsection(ar[i]);		// see if we're in this page or child
                              if ( highlight ) strIDs += 'X ';			// if so mark the section name
                              strIDs += '<a href="' + ar[i].sURL + '"><span class="actxxsmall"><b><font color="NETQUOTEVAR:FGCOLORCSS">' + ar[i].sName + '</font></b></span></a><br>';
                                {
                                if (ar[i].pChild)
                                  {
                                  for (var j=1;j<=ar[i].pChild.length;j++)
                                    {
                                    if (ar[i].pChild[j].sURL != null)
                                      {
                                      strIDs += '<a href="' + ar[i].pChild[j].sURL + '"><span class="actxxsmall"><font color="NETQUOTEVAR:FGCOLORCSS">' + ar[i].pChild[j].sName + '</font></span></a><br>';
                                      }
                                    }
                                  }
                                }
                              strIDs += '<br>'
                              }
                            }
                          return strIDs
                          }//-->
                          </SCRIPT>
                          Note that the inchildsection routine recursively scans all child sections of each top-level until it finds a match.
                          Norman - www.drillpine.biz
                          Edinburgh, U K / Bitez, Turkey

                          Comment


                            #14
                            Norman, is this the code to display this on the page?

                            <div align="left"><script language=Javascript1.2>
                            document.write(YahooSections(section_tree))
                            </script>

                            Does it do what im after, ie display the peer sections, ie when i'm in a child section i just want to be able to see other similar level sections in that parent section in the left hand bar.?

                            Thanks

                            Comment


                              #15
                              Hi Folk,

                              The site using the the moded menu is at http://www.shhh-itsourlittlesecret.co.uk please be aware it does have adult products.

                              If it's what your after let me know and I'll forward you the code, you will need to pop a custom var containing the section name in to the sub-section to show in the menu (very simple).

                              Norman's example may pull out the section/sub-section relationship automatically.
                              Justin Rowe
                              Shiver

                              Comment

                              Working...
                              X