ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Putting Pagination in an Embed

April 05, 2010 5:06pm

Subscribe [1]
  • #1 / Apr 05, 2010 5:06pm

    Michael Swanson

    32 posts

    I feel really dumb asking this question but is it possible to put the pagination code inside an embed?  I have a site that has pagination on several templates and I don’t want to have to replicate that code in all those templates.  Here is an example of what I am trying to do.

    {exp:weblog:entries weblog="articles" limit="5" orderby="date" sort="desc" paginate="both" disable="categories|category_fields|member_data|trackbacks"}
    
     --- the html for the page ---
    
     {embed="site_includes/_pagination"}
    
    {/exp:weblog:entries}

    Then in the embed I have this code:

    <div id="pagination">
          <span>Go To Page</span>
          <select id="pagination_pages">
            {exp:loop_plus start="1" end="{total_pages}" increment="1"}
            <option value="{index}">{index}</option>
            {/exp:loop_plus}
          </select> 
          <span>of {total_pages}</span>
          <div class="pagination_links">
            {pagination_links}
          </div>
      </div>

    I am getting {paginate}{/paginate}{paginate}{/paginate}{paginate}{/paginate} returned on the page.

    Any Ideas?

    Thanks

  • #2 / Apr 05, 2010 5:13pm

    Lisa Wess

    20502 posts

    You can’t break tags up like that, no.  However, in 2.0, you could put the pagination in a snippet. =)

  • #3 / Apr 05, 2010 5:16pm

    Michael Swanson

    32 posts

    bummer. :(  Thanks Lisa.  I can’t wait to get my hands on 2.0 but this is a commercial site and the client is not quite ready to adopt 2.0 yet.

  • #4 / Apr 05, 2010 5:19pm

    Michael Swanson

    32 posts

    Follow up question… can I put pagination inside a reverse related tag? ie:

    {reverse_related_entries weblog="rules_statutes" orderby="entry_date" sort="desc" paginate="both" limit="5"}
    
    -- html --
    
    {paginate}
    
    {pagination_links}
    
    {/paginate}
    
    {/reverse_related_entries}
  • #5 / May 26, 2010 3:03am

    Musa

    124 posts

    Hi swany10012, Pagination isn’t allowed inside reverse related entries.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases