Forum

Thread tagged as: Question, Problem

Perch repeater

Hello

I am trying to get a list to be created on a charity website of minutes and agendas and newsletters. The code on the page is:

<div class="row">
        <ul>
          <?php perch_content('Minutes, Agendas, Newsletters'); ?>
        </ul>
</div>

and the template to generate the list is:


<perch:repeater id="minutes_agendas_newsletters" label="Minutes, Agendas, Newsletters" max="12" editor="markitup" required="false"> <perch:before> <li> </perch:before> <perch:content type="textarea" id="minutes" label="Minutes, Agendas, Newsletters" editor="markitup" html="true" size="s" required="true" /> <perch:after> </li></perch:after> </perch:repeater>

The output only show one bullet point and the list is not liste at all (see https://www.facestalbans.co.uk/join.html)

I hope someone can help.

Thanks,

Paul

Paul Quillin-Creamer

Paul Quillin-Creamer 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

The before and after sections show before and after all items are output, not each item.

If you want each item to be in <li> then just add that to the template.

<perch:repeater id="minutes_agendas_newsletters" label="Minutes, Agendas, Newsletters" max="12" editor="markitup" required="false">
<li>
<perch:content type="textarea" id="minutes" label="Minutes, Agendas, Newsletters" editor="markitup" html="true" size="s" required="true" />
</li>
</perch:repeater>

Thanks Drew

That fixed the problem.

Thanks

Hello Drew

My client looked and tried to work with thsi and found the it was not right for them I changed the template to the one below but it will not create a bullet point for each new item added. Can you see why from the template code why this is not working see https://www.facestalbans.co.uk/join.html

<perch:repeater id="minutes_agendas_newsletters" label="Minutes, Agendas, Newsletters" max="12" editor="markitup" required="false">
  <perch:before>
    <li> 
  </perch:before>
  <a href="<perch:content id="minutes" type="file" label="Minutes, Agendas, Newsletters" />" target="_blank">
  <perch:content type="text" id="description" label="Description of Minutes, Agendas or Newsletters" order="1" html="true" required="true" title="true" />
  </a>
  <perch:after>
    </li>
  </perch:after>
</perch:repeater>

Many thanks,

Paul

Drew McLellan said:

The before and after sections show before and after all items are output, not each item.

If you want each item to be in <li> then just add that to the template.

<perch:repeater id="minutes_agendas_newsletters" label="Minutes, Agendas, Newsletters" max="12" editor="markitup" required="false">
<li>
<perch:content type="textarea" id="minutes" label="Minutes, Agendas, Newsletters" editor="markitup" html="true" size="s" required="true" />
</li>
</perch:repeater>

Paul, the original solution is still the valid solution.

Thank you