Forum

Thread tagged as: Question

HTML Template perch:before and perch:after

Hi,

I don't seem to be able to stop empty <ul></ul> elements from appearing in the HTML code.

The template I am using is as follows:

<perch:before><ul></perch:before>
<perch:repeater id="outcomes" label="Outcomes">
<li><perch:content id="outcome" type="text" label="Outcome" required="false" title="true" /></li>
</perch:repeater>
<perch:after></ul></perch:after>

If anyone has any advice, I'd appreciate that a lot

Garth Holmes

Garth Holmes 1 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Under what circumstances do you get empty tags?

Hi Drew,

I've enabled PERCH_DEVELOPMENT in config.php if that is to stop caching but as to your question, I've checked the rest of the template for any duplicate ID's and I tried putting the before/after tags with the unordered list in between the repeater tags but to no avail.

I am wondering if there can only be one set of before/after tags in a template and that I must use perch:if instead.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You can have one perch:before and perch:after tag pair per template, per repeater and per block.

Hi Drew,

Please pardon my ignorance here, but what is a "block"?

Are you saying that for a template if there is before/after tags, say at the top and the bottom of the page (template) that I can still have them inside repeaters?

Thanks again

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, templates, repeaters and blocks all have their own before and after sections.

Blocks are documented here: https://docs.grabaperch.com/docs/templates/blocks/