2

This has bugged me for a while and I'd really like to know what the heck is going on. Here's my template:

<header>
    {!-- Pre-Pagination Header Content --}

{exp:channel:entries
    channel='mychannel'
    limit='10'
    disable='member_data'
    paginate='both'
}
    {if count == 1}
        {paginate}
            {pagination_links}
                <ul class="pagination">
                    {previous_page}
                        <li class="prev"><a href="{pagination_url}">&laquo;</a></li>
                    {/previous_page}
                    <span class="numbers">
                        {page}
                            <li{if current_page} class="here"{/if}>{if current_page == ''}<a href="{pagination_url}">{/if}{pagination_page_number}{if current_page == ''}</a>{/if}</li>
                        {/page}
                    </span><!--/.numbers-->
                    {next_page}
                        <li class="next"><a href="{pagination_url}">&raquo;</a></li>
                    {/next_page}
                </ul><!--/.pagination-->
            {/pagination_links}
        {/paginate}
    </header>

    <div class="listing">
    {/if}

    {!-- Listing Item Content --}

    {if count == total_results}
        </div><!--/.listing-->

        <footer>
            {paginate}
                {pagination_links}
                    <ul class="pagination">
                        {previous_page}
                            <li class="prev"><a href="{pagination_url}">&laquo;</a></li>
                        {/previous_page}
                        <span class="numbers">
                            {page}
                                <li{if current_page} class="here"{/if}>{if current_page == ''}<a href="{pagination_url}">{/if}{pagination_page_number}{if current_page == ''}</a>{/if}</li>
                            {/page}
                        </span><!--/.numbers-->
                        {next_page}
                            <li class="next"><a href="{pagination_url}">&raquo;</a></li>
                        {/next_page}
                    </ul><!--/.pagination-->
                {/pagination_links}
            {/paginate}
        </footer>
    {/if}
{/exp:channel:entries}

The pagination inside the header displays fine, but in the footer, the pagination <ul> displays after the <footer> tag it's wrapped in.

Why? Why does ExpressionEngine do that? Does it have to do with the paginate parameter? Is there a way to fix it besides buying AB Pagination?

4

The pagination will display at the top, bottom or top and bottom of the channel entries tag (depending on what you set in the paginate="" parameter). It doesn't matter where you place {paginate} it in the template code itself.

Either use a pagination addon (like AB Pagination) or use Stash.

Mark Croxton has an example of how he moves his pagination to where he wants using Stash.
https://gist.github.com/croxton/1206694

2
  • Because EE never gets into trouble when it doesn't let the developer choose where to put code. ;)
    – kmgdev
    Jul 5 '13 at 17:12
  • Don't shoot the messenger :) Jul 5 '13 at 17:32
-1

I'm guessing this is more to do with a problem with your HTML (such as a tag that hasn't been closed or has been incorrectly nested) or, more likely, your CSS and quite possibly related to floated or absolutely position elements.

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.