Hello there!
This is my first post here on the boards, although I have been lurking in the shadows for a couple of months. Anyway...
For the past couple of days I've been trying to create a good old fashioned Section List In Bullets with Sub Sections In Bullets. My first port of call was the Advanced Guide (Page 62) but for some reason the code did not work, no matter what I tried (maybe this is just me? Although THIS THREAD hints that the code may be wrong). Next, I searched these very pages in search of an answer, again maybe I wasn't using the right search criteria but I couldn't find a solution that didn't involve some interesting php and I really wanted to avoid that.
So... after hours of messing around with conditions and blocks and variables, I believe I have finally found an interesting solution/work around. I'm posting it here to maybe get your impressions, check for any unforeseen issues or possibly even leave it here for other users after a similar solution.
I found that the variables SectionNameNext and SectionNamePrev only worked on the current SectionLevel. Therefore, if SectionNamePrev is empty it means you are at the beginning of the list and thus SectionNameNext could be used to find the end, allowing me to use these conditions to create a new list using the <ul> and </ul> tags. Like I said it is a bit of a hack but so far, I've had no problems with it!
So, here's the code (finally!):
Update 1: 10/10/2007, should work now. The method is a bit backwards as you can see with the </li> but because of the condition around it, it only renders where needed.
Update 2: 10/10/2007, thanks NormanRouxel! </li> on final top-level section added, I missed that!
This should provide you with the following HTML:
So there we go, combine this with some CSS, maybe highlight the current section and it could be quite powerful. I hope I haven't just made a fool of myself and this has actually been covered elsewhere!
This is my first post here on the boards, although I have been lurking in the shadows for a couple of months. Anyway...
For the past couple of days I've been trying to create a good old fashioned Section List In Bullets with Sub Sections In Bullets. My first port of call was the Advanced Guide (Page 62) but for some reason the code did not work, no matter what I tried (maybe this is just me? Although THIS THREAD hints that the code may be wrong). Next, I searched these very pages in search of an answer, again maybe I wasn't using the right search criteria but I couldn't find a solution that didn't involve some interesting php and I really wanted to avoid that.
So... after hours of messing around with conditions and blocks and variables, I believe I have finally found an interesting solution/work around. I'm posting it here to maybe get your impressions, check for any unforeseen issues or possibly even leave it here for other users after a similar solution.
I found that the variables SectionNameNext and SectionNamePrev only worked on the current SectionLevel. Therefore, if SectionNamePrev is empty it means you are at the beginning of the list and thus SectionNameNext could be used to find the end, allowing me to use these conditions to create a new list using the <ul> and </ul> tags. Like I said it is a bit of a hack but so far, I've had no problems with it!
So, here's the code (finally!):
Update 1: 10/10/2007, should work now. The method is a bit backwards as you can see with the </li> but because of the condition around it, it only renders where needed.
Update 2: 10/10/2007, thanks NormanRouxel! </li> on final top-level section added, I missed that!
Code:
<ul id="sectionListSide"> <actinic:block type="EntireSectionList"> <actinic:block if="%28%3cactinic%3avariable%20name%3d%22SectionNamePrev%22%20%2f%3e%20%21%3d%20%22%22%29"></li></actinic:block> <actinic:block if="%28%3cactinic%3avariable%20name%3d%22SectionNamePrev%22%20%2f%3e%20%3d%3d%20%22%22%29%20AND%20%28%3cactinic%3avariable%20name%3d%22SectionLevel%22%20%2f%3e%20%3d%3d%202%29" ><ul></actinic:block> <li<actinic:block if="%3cactinic%3avariable%20name%3d%22SectionID%22%20%2f%3e%20%3d%3d%20%3cactinic%3avariable%20name%3d%22MainSection%3a%3aSectionID%22%20%2f%3e"> id="currentPage"</actinic:block>><a href="<actinic:variable name="SectionPageName"/>"><actinic:variable name='SectionName'/></a> <actinic:block if="%28%3cactinic%3avariable%20name%3d%22SectionNameNext%22%20%2f%3e%20%3d%3d%20%22%22%29%20AND%20%28%3cactinic%3avariable%20name%3d%22SectionLevel%22%20%2f%3e%20%3d%3d%202%29" ></li></ul></actinic:block> <actinic:block if="%3cactinic%3avariable%20name%3d%22ListIndex%22%20%2f%3e%20%3d%3d%20%3cactinic%3avariable%20name%3d%22ListCount%22%20%2f%3e" > </actinic:block> </ul>
Code:
<ul id="sectionListSide"> <li>Section1</li> <li>Section2 <ul> <li>Sub-Section1</li> <li id="currentPage">Sub-Section2</li> </ul> </li> <li>Section3 <ul> <li>Sub-Section1</li> </ul> </li> </ul>
Comment