PDA

View Full Version : Nested Repeat


gary385539
07-30-2009, 08:19 AM
Hi all

I have seen a couple of threads on this subject and I cannot quite make the connection to my own issues.

I am trying to create a dynamic menu where when you hover over one item (the parent group) then if there are any sub-items (child groups) then they are displayed. The data is pulled from a single table that has three fields:

pgegrp_id : (the unique numerical identifier 1, 2, 3, 4, etc.)
pgegrp_parent : (if this menu item is a parent then the field contains 0, if it contains a number then it is a child of the record whose pgegrp_id is the same as this record)
pgegrp_heading : (The text that appears as the menu item/sub item)

I can repeat the field okay using either Data Assist Repeat or DW's own Region Repeat.

My questions is how would I create the nested repeat so that the parent is displayed with child records immediately under their respective parent as follows:

<ul>
<li>Parent 1</li>
<li>Parent 2</li>
<ul>
<li>Parent 2/Child 1</li>
<li>Parent 2/Child 2</li>
<li>Parent 2/Child 3</li>
</ul>
<li>Parent 3</li>
<ul>
<li>Parent 3/Child 1</li>
<li>Parent 3/Child 2</li>
</ul>

Hope this makes sense and hope you can help.

Cheers

Gary

Ray Borduin
07-30-2009, 08:58 AM
This is a feature in CSS Menu Writer v2.

You could use that to create your lists instead of the simple repeat regions which would require hand coding to pull off.

To do it by hand I wouldn't actually use a nested repeat. It would be a single repeat with some custom variables and IF statements.