Forum

Thread tagged as: Question, Problem

List on detail page

Hi guys, I've followed the guide here: https://docs.grabaperch.com/perch/content/functions/two-page-list-and-detail/ which has worked great so far. I'm now wanting to display my list using the list template on the detail page as well as the listing page. I've copied the code from the list page to and included it on the detail page but nothings showing up.

My listing page:

<?php
    perch_content_create('Portfolio', array(
      'template'   => 'portfolio_detail.html',
      'multiple'    => true,
      'edit-mode' => 'listdetail',
    ));
?>


<?php
    perch_content_custom('Portfolio', array(
      'template' => 'portfolio_list.html',
      'paginate' => true,
      'count' => 5,
      'page-links' => 'true',
    ));
?>

My detail page:

<?php
    perch_content_custom('Portfolio', array(
      'page' => '/portfolio/index.php',
      'template' => 'portfolio_detail.html',
      'filter' => 'slug',
      'match' => 'eq',
      'value' => perch_get('s'),
      'count' => 1,
    ));
    ?>

My attempt at including the listing on the detail page:

<?php
    perch_content_custom('Portfolio', array(
      'page' => '/portfolio/index.php',
      'template' => 'portfolio_detail.html',
      'filter' => 'slug',
      'match' => 'eq',
      'value' => perch_get('s'),
      'count' => 1,
    ));
    ?>

<?php
    perch_content_custom('Portfolio', array(
      'template' => 'portfolio_list.html',
      'paginate' => true,
      'count' => 5,
      'page-links' => 'true',
    ));
    ?>

No list shows up on the detail page using the last code block. Any help would be great! I'm sure I'm just missing something simple as it should just work, right?

Thanks!

David Clarke

David Clarke 0 points

  • 3 years ago

Doh!.. Just needed to reference the listing page from the detail page!

<?php
    perch_content_custom('Portfolio', array(
      'page' => '/portfolio/index.php',
      'template' => 'portfolio_detail.html',
      'filter' => 'slug',
      'match' => 'eq',
      'value' => perch_get('s'),
      'count' => 1,
    ));
    ?>

<?php
    perch_content_custom('Portfolio', array(
      'page' => '/portfolio/index.php',
      'template' => 'portfolio_list.html',
      'paginate' => true,
      'count' => 5,
      'page-links' => 'true',
    ));
    ?>