0

I would like to break out my pagination code into a separate embed file as the same code is used in multiple templates. However when I do it's just spitting out EE tags into the page rather than parsing them.

Is this a parse order issue? Is it possible to achieve this?

{exp:channel:entries 
    channel="events" 
    orderby="date" 
    sort="desc"  
    paginate="bottom"
    disable="category_fields|member_data|relationships"
    limit="5"
    dynamic="no"
  }

  <div class="card card-horizontal clearfix event-list 
    {if segment_2 == 'weekly'}hidden-xs-up{/if}" 
    {if segment_2 == 'weekly'}data-day="#{event_start_date  format='%D'}"{/if}
    >
    <div id="events-carousel" class="carousel slide" data-ride="carousel">
    {event_images cover_only="yes"}     
      <a href="/iba-kids/events/{url_title}">
        <img class="card-img-top img-fluid" src="{image:url:medium}" alt="{image:title}">
      </a>
    {/event_images}
    </div>
    <div class="card-block">
      <h4 class="card-title">{title}</h4>
      <p class="card-text">{exp:power_truncate length="110" cut_words="n" suffix="..."}{event_snippet}{/exp:power_truncate}</p>
      <a class="btn btn-primary category" href="/iba-kids/events/{url_title}">Read Article</a>      
    </div>
  </div> 

  {embed="inc/_paginate-full"}

  {/exp:channel:entries}

Embed Code:

        {paginate}
        <nav>
        {pagination_links}
          <ul class="pagination pagination-lg">
            {first_page}
            <li class="page-item">
              <a class="page-link" href="{pagination_url}" aria-label="First Page">First</a>
            </li>
            {/first_page}
            {page}
            <li class="page-item">
              <a class="page-link {if current_page}active{/if}" href="{pagination_url}">{pagination_page_number}</a>
            </li>
            {/page}
            {last_page}
            <li class="page-item">
              <a class="page-link" href="{pagination_url}" aria-label="Last Page">Last</a>
            </li>
            {/last_page}
          </ul>
        {/pagination_links}

        {pagination_links}
          <ul class="pagination pagination-lg pull-xs-right">
          {previous_page}
            <li class="page-item">
              <a class="page-link" href="{pagination_url}" aria-label="Previous">Previous</a>
            </li>
          {/previous_page}
          {next_page}
            <li class="page-item">
              <a class="page-link" href="{pagination_url}" aria-label="Next">Next</a>
            </li>
          {/next_page}
          </ul>
        {/pagination_links}
        </nav>
      {/paginate}
  • can you provide an example of your channel entries loop with the embed? – Jim Wyse Mar 30 '16 at 19:57
  • Hey Jim, just added the code to the post. Thanks – KoalaKid Mar 30 '16 at 20:03
  • You need to use a snippet instead for the pagination code, as an embed is parsed completely separately and after the parent template is parsed. – Peter Lewis Mar 31 '16 at 6:59
0

Most likely a parse order issue http://loweblog.com/downloads/ee-parse-order.pdf Embeds are processed after module tags.

| 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.