Forum
Sets of accordion-style content on one page
I have a simple site structure, and on one page I have 3 columns with an 'accordion' list in each - the title is clicked and the paragraph expands/collapses underneath.
So in each column I've got (for example col 1 below):
<?php
perch_content_create('How We Work – Accordions', array(
'template' => 'accordion.html',
'multiple' => 'true',
'filter' => 'section',
'match' => 'eq',
'value' => 'Strategy'
));
?>
And then my template:
<div class="accordionholder" data-ix="accordion-openclose">
<div class="accordionplus">+</div>
<div class="accordionminus" data-ix="start-invisible">–</div>
<div class="accordiontitle"><perch:content id="accordion-title" label="Title" type="text" /></div>
<div class="accordionexpandingpanel" data-ix="accordionpanel-start-hidden">
<p class="standardpara"><perch:content id="accordion-para" label="Paragraph" type="textarea" editor="redactor" html="true" /></p>
</div>
<perch:content id="section" label="Section" help="Choose the suitable column" type="select" options="Strategy, Sustainable Supply, Environment" required="true" />
</div>
...with the idea being that, similar to blog posts, I can show all items in their appropriate column, according to their 'section' value. I've got a load of items entered in the appropriate region.
Unsurprisingly to likely anyone who knows what they're doing with Perch, this doesn't work. My understanding of the CMS structure (or the API) is stumbling a little here, how can I achieve what I'm trying to do? Am I even close?
I've made some progress - as per the docs
Which I've now done... and then calling perch_content_custom in the subsequent columns. Some styling issues to fix but the principle is working.
Ok - let us know if we can help!