0

I have enough results for 2 pages, but my pagination links show 3 pages of results, the 3rd page being blank. Also, the segment that should show the pagination page number (i.e. P1, P2) says P2 for the second page, and then jumps to P4 on the third page. Anyone ever seen this before?

{exp:channel:entries channel="message" dynamic="no" limit="2" paginate="bottom" orderby="date" sort="desc" disable="categories|category_fields|member_data"}
        {series_association}
        {if series_association:no_results}
        <ul class="message-list">

            <li class="media-view">
            <h2><u><a href="{path=media/media-view/{url_title}}">{title}</a></u> - <i><h5 class="inline-header">{message_date format='%F %j, %Y'}</h5></i></h2> 
            <p>{message_summary}</p>
            </li>
        {/if}

        {if "{count}" == "{total_results}"}</ul>{/if}
        {/series_association}
        {paginate}

            <br /><p>Page {current_page} of {total_pages} pages {pagination_links}</p>

        {/paginate}

    {/exp:channel:entries}

2 Answers 2

1

The number jumping is dictated by the number of entries you're showing on the page. You have two entries, and so they go up in 2s, i.e.

Page 1: Entries 0 and 1

Page 2: Entries 2 and 3

Page 3: Entries 4 and 5

As for the blank page, the tag is paginating the channel entries returned from the channel entries tag. If there are 5 entries in the channel, you'll get 5 entries back and so 3 pages in the case. It doesn't look like you're outputting any content from the relationship, e.g. {series_association:title}, only if there are no results from the relationship?

8
  • that is correct. I'm trying to only show entries that do not have a relationship.
    – hyphen81
    Jul 11, 2013 at 10:08
  • Is it pulling all the entries for that channel and then limiting it to the relationship:no_results entries and causing the blank page? I've also noticed it seems to do some very weird things, and something tells me its because of the relationship tag I'm trying to use.
    – hyphen81
    Jul 11, 2013 at 11:08
  • Yes, your template is pulling all the entries and paginating them, then running the if statements. So you get 3 pages to cover all the entries; just not all are being displayed because of the conditions. Jul 11, 2013 at 11:18
  • I removed the relationship tags, and everything functions exactly right. I was having a lot of weird problems, like page 2 would only have one entry on it, while page one and three both had multiple entries. The problem I have now is that all the entries display correctly, but I still only want to have entries that do not have a relationship field populated. Basically, I'm building a church site, and I have a page where I'm displaying all the messages associated with a series, and then, on this page, I'd like to have all the individual messages NOT associated with a series...
    – hyphen81
    Jul 11, 2013 at 11:40
  • It's proving to be more difficult than I ever imagined it would be.
    – hyphen81
    Jul 11, 2013 at 11:41
1

As Dave has mentioned the number that you see in the URL (PXXX) does not have a correlation to the page that you are on in the sense that you think. In your example you have a limit of 2 entries per page so that is why you are seeing the number after P increment by 2 for each page. If you were to navigate to the second page then click the link back to the first page of entries you would see "P0" in the URL.

The number after P tells EE to offset the entries in the loop by that number. So in your example

Page 1: Entries 1 and 2 - URL Value: P0 - Offset Value: 0

Page 2: Entries 3 and 4 - URL Value: P2 - Offset Value: 2

Page 3: Entries 5 and 6 - URL Value: P4 - Offset Value: 4

Basically for page 2 of your results EE is automatically replacing this opening channel entires tag (notice the offset parameter being added)

{exp:channel:entries channel="message" dynamic="no" limit="2" offset="2" orderby="date" sort="desc" disable="categories|category_fields|member_data"}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.