Forum

Thread tagged as: Question, Podcasts

Podcast Pagination

I am trying to add pagination to my podcast page as well, and I am having issues

// episodes_list.html

<perch:after> </div> <!-- added the perch code for pagination --> <perch:if exists="paging"> <div class="paging"> Page <perch:content id="current_page" type="hidden" /> of <perch:content id="number_of_pages" type="hidden" /> <perch:if exists="not_first_page"> <a href="<perch:content id="prev_url" type="hidden" encode="false" />">Previous</a> </perch:if> <perch:content id="page_links" encode="false" /> <perch:if exists="not_last_page"> <a href="<perch:content id="next_url" type="hidden" encode="false" />">Next</a> </perch:if> </div> </perch:if> <!-- perch pagination code ends --> </perch:after>

// messages.php

1) <?php perch_podcasts_episodes(perch_get('s')); ?> - displays entire podcast list

2) <?php perch_podcasts_episodes_custom(perch_get('s')); ?> - no podcast list is displayed - the error seems to be here when i add the '_custom'

3) <?php perch_podcasts_episodes_custom(perch_get('s'), array( 'paginate' => true, 'count' => 8, )); ?> - no podcast list is displayed

Any help would be greatly appreciated.

Thank you,

Kevin Brandon

Kevin Brandon 0 points

  • 6 years ago

Keven. There is no...

perch_podcasts_episodes_custom()

The correct code would be...

perch_podcasts_episodes(perch_get('s'),array(
'paginate'=>true,
'count'=>8
);

An options array can be passed as the second argument.

(UNTESTED)

Thanks Robert,

I can now see the limited number of episodes on the page, as well as the 'Page of Next' navigation at the bottom.

Now the next issue is that the pagination does not display the number of pages available, and when I click the 'next' link, the current page refreshes.

// episodes_list.html

    <perch:if exists="paging">
        <div class="paging">
          Page <perch:content id="current_page" type="hidden" /> of <perch:content id="number_of_pages" type="hidden" />
          <perch:if exists="not_first_page">
            <a href="<perch:content id="prev_url" type="hidden" encode="false" />">Previous</a>
    </perch:if>
          <perch:content id="page_links" encode="false" />
          <perch:if exists="not_last_page">
              <a href="<perch:content id="next_url" type="hidden" encode="false" />">Next</a>
    </perch:if>
    </div>
  </perch:if>

Really appreciate your help so far!