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.

Pagination links keep reloading my root/index page

December 06, 2011 1:52pm

Subscribe [3]
  • #1 / Dec 06, 2011 1:52pm

    ccrumbley

    1 posts

    Hey guys,

    This was a problem that existed on our previous 2.1.1 install. We are using the Structure module, and we had an older version of that as well, using the now deprecated structure:pagination tag.

    We have since upgraded both EE(to 2.3.1) and Structure(to 3.1.3) which now uses EE’s native pagination. We figured this upgrade would be the answer to the issues we were having, but it does’t seem to be the case. The Next link is linking to the correct URL now, but it’s still just reloading the sites index page, rather than a second page of entries.

    We’ve modified our templates to use the native pagination:

    {exp:channel:entries channel="news" limit="3" dynamic="off" paginate="bottom"}
    
    <div class="entry news">
    
     <h4>{title}</h4>
    <p> <br />
     {news-article}</p>
    
    <p></div></p>
    
    <p>{paginate}<br />
     {if previous_page}<br />
      <a href="http://{auto_path}">Previous Page</a>  <br />
     {/if}<br />
     {if next_page}<br />
      <a href="http://{auto_path}">Next Page</a><br />
     {/if}<br />
    {/paginate}</p>
    
    <p>{/exp:channel:entries}

    Does anything look out of place here?

    We’ve also tried disabling the htaccess and putting the default index.php back in the url, but it doesn’t make a difference. The Next link is still just loading our root page.. So I can’t imagine it’s a redirect issue at this point.

    Thanks

  • #2 / Dec 07, 2011 2:55pm

    Dan Decker

    7338 posts

    Hi ccrumbley,

    Welcome to the Forums!

    Is that your complete template code? If not, can you supply that for us? If you take Structure out of the picture, does pagination produce the results that you are expecting? Also, can you post the rendered output form your browser?

    Thanks!

  • #3 / Dec 08, 2011 1:34pm

    jaasum

    36 posts

    Hello,

    I am a developer working on the above code.

    Here is the full template. This is using the latest versions of ExpressionEngine and Strucuture. We are removing index.php through the .htaccess as outlined in the official EE documentation. To the best of my understanding the following code is the recommended way to render a “Page” with a “Listing” in Structure and have the pagination function correctly. The below code does not list the news entires - if we add “dynamic=“off” it will list the news entries, but then pagination redirects to a 404.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
     
     <head>
     
      {embed="embeds/head"}
      
      <title>{exp:structure:titletrail}</title>
     
     </head>
     
     <body id="interior">
     
      {embed="embeds/header"}<!-- div#content is opened here -->
       
       {embed="embeds/secondarynav" channel_name="basicpage"}
       
       <div id="content-main" class="clear">
       
        {exp:channel:entries channel="basicpage"}
         
         {basicpage-body}
        
        {/exp:channel:entries}
        
        {exp:channel:entries channel="news" limit="5" paginate="bottom"}
        
        <div class="entry news">
        
         <h4>{title}</h4>
    <p>     <br />
         <span class="date">{entry_date format="%F %d %Y"}</span> | {news-author}<br />
         <br />
         {news-article}<br />
         <br />
         {if basicpage-pdf == 'Yes'}<br />
         <a href="http://get.adobe.com/reader/" rel="external" class="adobereader">Get Adobe Reader</a><br />
         {/if}<br />
        <br />
        </div></p>
    
    <p>    {paginate}<br />
         Page {current_page} of {total_pages} pages {pagination_links}<br />
        {/paginate}</p>
    
    <p>    {/exp:channel:entries}<br />
        <a href="http://{site_url}/archive/news/">View Archive</a><br />
       <br />
       </div><br />
       <br />
       <div id="content-sub" class="clear"><br />
       <br />
        {embed="embeds/sidebar" channel_name="basicpage"}<br />
       <br />
       </div><br />
         <br />
      </div><!-- close div#content --></p>
    
    <p>  <br />
      {embed="embeds/footer"}<br />
     <br />
     </body><br />
     <br />
    </html>

    The browser output is causing some forum errors - but it displays the “basicpage” content just fine, which is our Structure “Page”. The “news” channel displays no content which is our “listing”. As I understand leaving dynamic on is needed in order for the listing pagination to work.

  • #4 / Dec 08, 2011 2:36pm

    jaasum

    36 posts

    Found a solution to this. Running the latest version of all the software, standard EE pagination, Pages and Listings with structure, template tags etc. The issue was that at some point while this site was upgraded in the past the structure extension (just the extension) needed to be disabled and re-enabled. That fixed the issue.

  • #5 / Dec 08, 2011 5:49pm

    Dan Decker

    7338 posts

    jaasum,

    Excellent news. Thanks for posting your solution!

    If you need us in the future, just let us know.

    Cheers!

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

ExpressionEngine News!

#eecms, #events, #releases