How to omit some sections from expanding.

Two level, smoothly expanding, search engine friendly accordion menu.
Post Reply
norman
Site Admin
Posts: 1252
Joined: Sat Feb 07, 2004 9:55 pm

How to omit some sections from expanding.

Post by norman »

This article may no longer be required as Accordion Menu now (V2.05 onwards) has a capability to limit the number of second and third level Sections displayed.

TOP LEVEL:

You may have some top-level Sections that have too many sub-sections to comfortably display and want to omit them from expanding.

This requires us to put a Condition ! DontExpandInAccordion around 2 bits of code.

Go to Design / Library / Variables, right-click Accordion Menu and choose New Variable.
Create the variable as below:
DontExpandInAcordion.jpg
DontExpandInAcordion.jpg (257.85 KiB) Viewed 16808 times
1)Go to Design / Library / Layouts / Accordion Menu / Glossy Accordion Menu.
Look for a line starting <a sid=........

In that line there is a fragment of code:

Code: Select all

<actinic:block type="ChildSectionList"><actinic:block if="%3cactinic%3avariable%20name%3d%22ListIndex%22%20%2f%3e%20%3d%3d%201" > submenuheader</actinic:block></actinic:block>
Amend it to be (leaving the rest of the line intact):

Code: Select all

<actinic:block if="%21%20%3cactinic%3avariable%20name%3d%22DontExpandInAccordion%22%20%2f%3e"><actinic:block type="ChildSectionList"><actinic:block if="%3cactinic%3avariable%20name%3d%22ListIndex%22%20%2f%3e%20%3d%3d%201" > submenuheader</actinic:block></actinic:block></actinic:block>
2) A few lines below this should be:

Code: Select all

	<actinic:variable name="AccordionSubSections" />
Amend this by surrounding it with the same Condition as used in (1):

Code: Select all

	
	<actinic:block if="%21%20%3cactinic%3avariable%20name%3d%22DontExpandInAccordion%22%20%2f%3e"><actinic:variable name="AccordionSubSections" /></actinic:block>
Now in your Section Details, under Accordion Menu, there will be a variable DontExpandInAccordion that you can set to true to disable particular top-level Sections.

SECOND LEVEL:

To use this to prevent a Second level section from expanding, create the variable DontExpandInAccordion as per above.

Then we need to add the Condition code && (! DontExpandInAccordion) into two existing BlockIfs.

Edit layout Accordion Sub Sections and look for the line (near line 3):

Code: Select all

<actinic:block if="%3cactinic%3avariable%20name%3d%22AM%2dThirdLevelShow%22%20%2f%3e" >
Replace it with:

Code: Select all

<actinic:block if="%3cactinic%3avariable%20name%3d%22AM%2dThirdLevelShow%22%20%2f%3e%20%26%26%20%28%21%20%3cactinic%3avariable%20name%3d%22DontExpandInAccordion%22%20%2f%3e%29" >
Also look for the the second occurrence of the same code (near line 20):

Code: Select all

<actinic:block if="%3cactinic%3avariable%20name%3d%22AM%2dThirdLevelShow%22%20%2f%3e" >
Replace it with:

Code: Select all

<actinic:block if="%3cactinic%3avariable%20name%3d%22AM%2dThirdLevelShow%22%20%2f%3e%20%26%26%20%28%21%20%3cactinic%3avariable%20name%3d%22DontExpandInAccordion%22%20%2f%3e%29" >
Now in your Section Details, under Accordion Menu, there will be a variable DontExpandInAccordion that you can set to true to disable particular second-level Sections.

N.B. Tweaks such as this are not supported.
Norman
vistamaster
Posts: 13
Joined: Thu Sep 02, 2010 4:48 pm

Re: How to omit a particular top-level section from expanding.

Post by vistamaster »

Perfect, many thanks!!! I've created that variable, less manual work included now and in the future when new requirement for omitting top-level section from expanding arises :D
norman
Site Admin
Posts: 1252
Joined: Sat Feb 07, 2004 9:55 pm

Re: How to omit some top-level section from expanding.

Post by norman »

I've updated my original post to use that Variable as it's much more general purpose that way.
Norman
Aquatix-2u
Posts: 1
Joined: Sun Feb 20, 2011 12:25 am

Re: How to omit some top-level sections from expanding.

Post by Aquatix-2u »

This works really well for me but I also have some sub-sections that have too many sub-sub-sections. Can I stop the subsections from expanding?
norman
Site Admin
Posts: 1252
Joined: Sat Feb 07, 2004 9:55 pm

Re: How to omit some top-level sections from expanding.

Post by norman »

Fixing this for sub-sections is much trickier.

However I have a better way. I've updated the menu so you can specify a limit for the number of sub and sub-sub sections. If you use this you get an automatic additional "Show All" link to the parent Section.

Email me and I'll send you a copy.
Norman
norman
Site Admin
Posts: 1252
Joined: Sat Feb 07, 2004 9:55 pm

Extending this to work on Sub-Sections

Post by norman »

I've amended post #1 above to show how to use this on second-level Sections too.
Norman
Post Reply