Forum

Thread tagged as: Question

Nested Unordered Lists

Hi,

I'd like to know if there is a simple way to create a .html template for nested unordered lists.

The code I am trying to use is as follows:

<ul>
<perch:repeater id="electives" label="Electives">
<li>
    <perch:content id="elective" type="text" label="Elective Units" required="false" title="true" />
    <ul>
        <perch:repeater id="elect">
        <li><perch:content id="elected" type="text" Label="Elective Groups" required="false" title="true" /></li>
        </perch:repeater>
    </ul>
</li>
</perch:repeater>
</ul>

but it does not nest the elements in Perch CMS, how come?

Garth Holmes

Garth Holmes 1 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Hi Garth - you can't nest repeaters, that's simply not supported.

Hi,

So is there a workaround?

Simon Clay

Simon Clay 127 points

Hi Garth,

Is this your whole template, or is it part of a larger one?

If this is your whole template, you could make it a 'repeating region' and use a template such as this:

<perch:before>
<ul>
</perch:before>
    <li>
        <perch:content id="elective" type="text" label="Elective Units" required="false" title="true" />

        <perch:repeater id="elect">
            <perch:before>
            <ul>
            </perch:before>
                <li><perch:content id="elected" type="text" Label="Elective Groups" required="false" title="true" /></li>
            <perch:after>
            </ul>
            </perch:after>
        </perch:repeater>
    </li>
<perch:after>
</ul>
</perch:after>

That seems to have worked, thank you very much.

The only problem is, it cannot be used with other elements unless multiple is set to true and it reproduces other content such as when used with an accordion

It's a pity there are no "off the shelf" solutions for this kind of thing and that it takes a real skill to be able to do what is relatively simple in HTML.