Announcement

Collapse
No announcement yet.

Navigation - Why MainSection::SectionNumber not aloud in BLOCK

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

    Navigation - Why MainSection::SectionNumber not aloud in BLOCK

    Hi everyone.

    This is my first ever post on the forum. I've been using Actinic for about 4 months and have found the forum invaluable so far - thanks to everyone involved!

    My current issue involves trying to get a static menu to display the child sections of the current section. For example, if I'm in section 2 - the menu will look like this:

    Section 1
    Section 2
    Sub-Section 2a
    Sub-Section 2b
    Sub-Section 2c
    Section 3
    Section 4

    I've read loads of threads about this but hadn't managed to get anything to work. Anyway, after a long day today I finally came up with a solution. However, It is fairly long winded and as I add more sections it will require further work.

    If you look at the working menu here: http://www.the-red-box.co.uk/plumbits


    you can see what I'm trying to achieve in the menu. The way I've done it so far is to create a variable 'SectionNumber' (thanks to CDicken for this bit) and then in my main page layout use 4 different list layouts, each with a BLOCK around it, for the 4 different menu states. Then depending on the SectionNumber you are on it will display the appropriate menu. However, if I've got 4 parent sections I need 4 different Layouts. Here's the problem... If I've got 50 parent sections, as I have on another site for which I want to use the menu, I've got a lot of layouts and BLOCKS to do.

    I have got a solution in head but I can't make it work. I'm looking for someone to help please. I think if I can put the following variable qualifier into a BLOCK:

    <actinic:variable name="MainSection::SectionNumber" />

    It will work. However when I try, I get a message saying that this is an 'invalid expression'. Here's my planned code:

    Code:
    <actinic:block if="%3cactinic%3avariable%20name%3d%22IsSectionIncludedInSiteMap%22%20%2f%3e" >
    <a href="<actinic:block if="%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e%20AND%0d%3cactinic%3avariable%20name%3d%22UnregCustomersAreNotAllowed%22%20%2f%3e" ><actinic:variable name="SectionPageName" /></actinic:block><actinic:block if="%28%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e%20%3d%3d%20false%29%20OR%0d%28%3cactinic%3avariable%20name%3d%22UnregCustomersAreNotAllowed%22%20%2f%3e%20%3d%3d%20false%29" ><actinic:variable name="SectionURL" /></actinic:block>" class="product_section">
       <Actinic:Variable Name="SectionName"/>
    </a>
    </actinic:block>
    </br>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22SectionNumber%22%20%2f%3e%20%3d%3d%20%3cactinic%3avariable%20name%3d%22MainSection%3a%3aSectionNumber%22%20%2f%3e" >
    	<actinic:block type="ChildSectionList" >
    &nbsp;<a href="<actinic:variable Name="SectionPageName"/>">
       <actinic:variable Name="SectionName"/>
    </a>
    <br />
    </actinic:block>
    
    </actinic:block>
    I'm not entirely sure how clear I've been but if you need anymore info just let me know.

    Many thanks in advance, Rob.
    Last edited by robmackley; 21-Apr-2008, 08:44 PM. Reason: Spelling mistake
    Red Box Digital Media Ltd - Website Design Stafford

    #2
    You should be able to do this without needing any custom variables.

    Something like:
    Code:
    <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%27Section%27" >
    	<actinic:block php="true">
    		// Section page - remember current section info
    		$thissectionid = '<actinic:variable name="SectionID" encoding="perl" selectable="false" />';
    		$foundparent = false;
    	</actinic:block>		
    </actinic:block>
    
    <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27Section%27" >
    	<actinic:block php="true">
    		// not on Section page - dummy section info
    		$thissectionid = 'XXX';
    		$foundparent = false;
    	</actinic:block>		
    </actinic:block>	
    
    <actinic:block type="EntireSectionList">
    	<actinic:block php="true">
    		$menusectionid = '<actinic:variable name="SectionID" encoding="perl" selectable="false" />';
    		$menusectionlevel = '<actinic:variable name="SectionLevel" encoding="perl" selectable="false" />';
    		if ( $menusectionlevel == 1 )
    			{
    			// display top-level sections
    			echo '<br/><actinic:variable name="SectionName" encoding="perl" selectable="false" />';
    			}
    		if ( $foundparent )
    			{
    			// sub-section of current section (or possibly we've done them all)
    			if ( $menusectionlevel == 2 )
    				{
    				// woohoo child of current parent
    				echo '<br/>--<actinic:variable name="SectionName" encoding="perl" selectable="false" />';
    				}
    			if ( $menusectionlevel == 1 )
    				{
    				// we must be back at a top-level section
    				$foundparent = false;
    				}
    			}
    		if ( ($thissectionid == $menusectionid) && ($menusectionlevel == 1) )
    			{
    			// we've just started on the current section
    			$foundparent = true;
    			}
    	</actinic:block>	
    </actinic:block>
    The above displays top-level sections only and also the children of the current top-level section. I've not put the links in (for simplicity) so you'll have to do that bit yourself.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Thanks Norman. That works great for top and second level sections! How about with a 3rd level of subsection?

      See: http://www.the-red-box.co.uk/plumbit...ispensers.html

      Your version is the one in grey.
      Last edited by robmackley; 22-Apr-2008, 08:37 AM. Reason: Spelling mistake
      Red Box Digital Media Ltd - Website Design Stafford

      Comment


        #4
        How about with a 3rd level of subsection?
        Use my code as a basis for writing that yourself. Much trickier. You'd have to detect all parent sections and show that tree expanded. I do something like that on my Collapso menu ( see http://www.drillpine.biz/v8collapso5/ ) where the appropriate path is shown expanded.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Thanks for this Norman.

          Having thought about this I'm going to stick with 2 levels for now. When I've got some more time I'd love to get this working for a 3rd and 4th level.

          I have used your Collapso menu on one of my sites and it works a treat - Although I've got another 3000 products to add next month and this could add a further 100 subsections so I might be pushing it a bit. I seam to remember the readme suggesting a maximum of a few hundred!

          Thanks again, Rob
          Red Box Digital Media Ltd - Website Design Stafford

          Comment

          Working...
          X