0

I am having and issue with pagination. I have 8 entries and displaying 4 per page. Because of the layout I cannot include the pagination in the first channel entries tag that displays the entries so I need to add a second channel entries tag just for the pagination. Problem is when I click the next page and display the next 4 entries I still get the same first 4 entries.

<div class="blog">
        <h4 class="heading colr">Messages</h4>
        <ul>
{exp:channel:entries channel="messages" limit="4" dynamic="yes" disable="categories|member_data|category_fields"}

            <li>
                <p class="date">{entry_date format="%M"}<br />{entry_date format="%d"}</p>
                <h2 class="colr">{title}</h2>
                <div class="clear"></div>
                <div class="cont">

                </div>
                <div class="clear"></div>
                <div class="blog_links">

                    <p class="postedby">Speaker: {speaker}</p>
                </div> 
            </li>
{/exp:channel:entries}

                     </ul>
    </div>


{exp:channel:entries channel="messages" limit="4" disable="categories|member_data|category_fields" paginate="bottom"}
    {paginate}
        {pagination_links}
    <ul>
            {first_page}
                    <li><a href="{pagination_url}" class="page-first">First Page</a></li>
            {/first_page}

            {previous_page}
                    <li><a href="{pagination_url}" class="page-previous"><</a></li>
            {/previous_page}

            {page}
                    <li><a href="{pagination_url}" class="page-{pagination_page_number} {if current_page}active{/if}">{pagination_page_number}</a></li>
            {/page}

            {next_page}
                    <li><a href="{pagination_url}" class="page-next">></a></li>
            {/next_page}

            {last_page}
                    <li><a href="{pagination_url}" class="page-last">Last Page</a></li>
            {/last_page}
    </ul>
        {/pagination_links}
    {/paginate}
{/exp:channel:entries}
0

Won't work because the channel:entries tag relies on the paginate parameter. If you don't include it EE won't read the pagination segment in the URL, so won't know you're on the second page of a paginated list.

Assuming the issue is your markup and you only want to close the list markup before you open the pagination elements markup, try this:

<div class="blog">
  <h4 class="heading colr">Messages</h4>
  <ul>
    {exp:channel:entries channel="messages" limit="4" dynamic="yes" paginate="bottom" disable="categories|member_data|category_fields"}

      <li>
        <p class="date">{entry_date format="%M"}<br />{entry_date format="%d"}</p>
        <h2 class="colr">{title}</h2>
        <div class="clear"></div>
        <div class="cont"></div>
        <div class="clear"></div>
        <div class="blog_links">
            <p class="postedby">Speaker: {speaker}</p>
        </div> 
      </li>
    {if count == total_results}
  </ul>
</div>
    {/if}

{paginate}
  {pagination_links}
  <ul>
    {first_page}
      <li><a href="{pagination_url}" class="page-first">First Page</a></li>
    {/first_page}
    {previous_page}
      <li><a href="{pagination_url}" class="page-previous"><</a></li>
    {/previous_page}
    {page}
      <li><a href="{pagination_url}" class="page-{pagination_page_number} {if current_page}active{/if}">{pagination_page_number}</a></li>
    {/page}
    {next_page}
      <li><a href="{pagination_url}" class="page-next">></a></li>
    {/next_page}
    {last_page}
      <li><a href="{pagination_url}" class="page-last">Last Page</a></li>
    {/last_page}
  </ul>
  {/pagination_links}
{/paginate}
{/exp:channel:entries}

Note the:

{if count == total_results}
    </ul>
  </div>
{/if}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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