We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Pagination and Template Route Manager

How Do I?

ThePixelPusher's avatar
ThePixelPusher
82 posts
10 years ago
ThePixelPusher's avatar ThePixelPusher

Hi,

I have this page for showing articles, and I want to have links below the article to paginate to the next and previous.

This is my code:

{exp:channel:entries channel="articles" dynamic="yes" url_title="{segment:article}" status="open|featured" paginate="bottom"}
  <section class="block block--intro">
   <div class="panel">
    <header class="panel__heading">
     <h1>{title}</h1>
    </header>
    <div class="panel__body">
     <figure>
      {exp:ce_img:pair src="{article_featured_image}"}
       {made}
      {/exp:ce_img:pair}
     </figure>

    </div>
    <footer class="panel__footer">
     <ul class="list-unstyled list-inline meta">
      <li><i class="fa fa-user fa-fw"></i>Written by {author}</li>
      <li><i class="fa fa-calendar fa-fw"></i><time>{entry_date format="%F %j%S %Y"}</time></li>
      <li><i class="fa fa-folder-o fa-fw"></i>{categories}{category_name}, {/categories}</li>
     </ul>
    </footer>

   </div>
  </section>

  <main>
   <article class="article">
    <div class="wrapper">

          {article_content}


    </div>
   </article>

   {paginate}
    {if previous_page}
     <a href="http://{auto_path}">Previous Page</a>  
    {/if}
    {if next_page}
     <a href="http://{auto_path}">Next Page</a>
    {/if}
   {/paginate}

  </main>



  {/exp:channel:entries}

For my Template Route for this template I have:

articles/{article:alpha_dash} and set Segments Required to Yes.

What am I doing wrong? No code is being displayed for the pagination.

       
Tyssen's avatar
Tyssen
756 posts
10 years ago
Tyssen's avatar Tyssen

Looking at the docs, they say:

Template Routes has built in rules for handling pagination and categories:
/blog/{section:category}/{page:pagination}
For this set up to work, “Require All Segments” must be set to no. With the above route and segments set to optional the following URLs will match:
       
ThePixelPusher's avatar
ThePixelPusher
82 posts
10 years ago
ThePixelPusher's avatar ThePixelPusher

Yeah I tried that. They could give a better example really.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.