Forum

Thread tagged as: Question, Configuration, Docs

Perch Every Tag Question

Perch 3.0.9

<perch:before>
  <div class=“row”>
</perch:before>
Your code here
<perch:every count="3">
  </div>
  <div class=“row”>
</perch:every>
<perch:after>
  </div>
</perch:after>

Watched the video confused. With the every tag, you basically have the </div> tag in there twice is that correct?

Carol Swinehart

Carol Swinehart 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What are you trying to accomplish?

I want a row of 3 items to fill itself with items I type in. Connected with this will have to be the ability to put perch code within perch code. I need to be able to have <perch:if exists="address<perch:content id="number" type="text" label="Item number"> This id="number" would be put in for every instance in that entry of a numbered area i.e. image1, link1 and others. Will that work? Then I want to put that statement in the every statement so I can have multiple google maps connected to information on the page without having to hardcode number the items. Is that possible?

<perch:if exists="address1"><perch:before><dl></perch:before><dt>
<perch:if exists="image1"><img src="<perch:content type="image" id="image1" label="Image" width="200" />" alt="<perch:content type="text" id="alt1" label="Description" required="false" help="e.g. Photo of MD John Smith with his best wig on" title="true" />" /><br /></perch:if>
<perch:if exists="link1"><a href="<perch:content id="link1" type="text" label="Link" />"><perch:content id="name1" type="text" label="Name" /></a></perch:if>
<perch:if exists="name1a"><perch:content id="name1a" type="text" label="Name if no link" /></perch:if>
</dt>
<dd><perch:content id="address1" type="text" label="Address" /> &nbsp;&nbsp;&nbsp; <a data-open="exampleModal11"><perch:content id="word1" type="text" label="Put in word Map if not empty field" /></a> <div class="reveal" id="exampleModal11" data-reveal> <a href="https://www.google.com/maps/place/<perch:content id="address1" type="text" Label="Address" />">MAP HERE</a> 
 <button class="close-button" data-close aria-label="Close reveal" type="button">    <span aria-hidden="true">&times;</span></button></div>
 <br /><a href="tel:<perch:content id="phone1" type="text" label="Phone" />"><perch:content id="phone1" type="text" label="Phone" /></a><br />
<perch:content id="textb1" type="textarea" label="Paragraph Description" html="true" editor="ckeditor" imagewidth="640" imageheight="480" />
 <br /> </dd> <perch:after></dl></perch:after></perch:if>
Drew McLellan

Drew McLellan 2638 points
Perch Support

I need to be able to have <perch:if exists="address<perch:content id="number" type="text" label="Item number"> This id="number" would be put in for every instance in that entry of a numbered area i.e. image1, link1 and others. Will that work?

No, that won't work.

Is there any workaround that would work. Or does it have to be hard coded.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You shouldn't need to manage Perch IDs in that way - I think you might be overcomplicating things. If you have a multiple item region then it should just work.

If you need specific IDs for your front end code, that's a completely different issue.