Forum

Thread tagged as: Question

Identifying the first page of pagination

Hi Drew,

Is there a way of identifying which is the first page when using pagination, I would like to have an intro para above the paginated content but only want it visible on the first page. If I could identify the first page I could hide it on the subsequent ones.

I've achieved the effect using a combination of perch before and if/else however it results in unnecessary entry fields in the admin.

Any thoughts?

Nick Loat

Nick Loat 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

All the templates variables are listed here: https://docs.grabaperch.com/docs/templates/pagination/

You could do something like

<perch:if id="current_page" value="1">
    Welcome to the first page of the rest of your life.
</perch:if>

That's kinda what I arrived at using not_first_page but more streamlined without the need for an else statement - however in the admin, because its a region that allows multiple items it means that for each item I get an "Intro" entry field, which only needs to be filled on the first instance to add the intro para but not on all the subsequent ones. No worries its not a biggie.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Put the intro in another region and pass it into the template.

Hi Drew, I'm back on to this in an attempt to tidy up a few loose ends, not entirely sure how to do this could you elaborate.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Sure, which part are you having problems with?

how to pass a stand-a-lone intro region into the template of the content paginated (desired end result is an intro para which only appears at the top of the first page of paginated content.)

Drew McLellan

Drew McLellan 2638 points
Perch Support