Forum

Thread tagged as: Question, Problem

Generating a list of links within a list and detail page

Not sure how to describe this exactly, but here goes.

  • I have a standard list and details page set up and working correctly.
  • On the details page I am using Blocks to add multiple items (speakers with bio)
  • An id on the speakers name is set from the name (using urlify)

I want to generate a list of links from the all speaker IDs. Heres the detail template:


<h1><perch:content id="group" type="text" label="Speaker Group" required="true" title="true" /><small><a href="/speakers/">Other Speakers →</a></small></h1> <perch:content id="slug" for="group" type="slug" suppress="true" /> <perch:blocks> <perch:block type="text" label="Add Speaker"> <div class="speaker"> <h2 id="<perch:content id="speaker" urlify="true" order="2" />"><perch:content id="speaker" type="text" label="Speaker Name" required="true" title="true" order="1" /></h2> <perch:repeater id="blurb" label="Text Block"> <perch:if exists="blurb-title"> <h4><perch:content id="blurb-title" type="text" label="Block Title" /></h4> </perch:if> <perch:if exists="blurb-session"> <p><perch:content id="blurb-session" type="text" label="Block Sub Heading" /></p> </perch:if> <perch:content id="blurb-desc" type="textarea" label="Block Text" html="true" editor="redactor" /> </perch:repeater> </div> </perch:block> </perch:blocks>
Winston Grace

Winston Grace 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I think you'd make a copy of the template, keep the blocks but strip them back to just the links. Then output your region again using this new template.

Could you detail that a little further? Currently I am outputting my list and detail region like this:


<?php perch_content_create('Speakers', array( 'template' => 'speaker_detail.html', 'multiple' => true, 'edit-mode' => 'listdetail', )); if (perch_get('s')) { // Detail mode perch_content_custom('Speakers', array( 'template' => 'speaker_detail.html', 'filter' => 'slug', 'match' => 'eq', 'value' => perch_get('s'), 'count' => 1, )); } else { // List mode perch_content_custom('Speakers', array( 'template' => 'speaker_listing.html', )); } ?>

Would I create the the simplified speaker_detail and output it within the if statement?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Where would you like it to appear? Put it at that point in the page.

I was thinking something like:

<perch:blocks>
    <perch:block type="text" label="Add Speaker">
            <a href="#<perch:content id="speaker" urlify="true" order="2" />"><perch:content id="speaker" type="text" label="Speaker Name" required="true" title="true" order="1" /></a>
    </perch:block>
</perch:blocks>