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.

Query Pagination link display broken in EE2

April 02, 2011 7:49pm

Subscribe [6]
  • #1 / Apr 02, 2011 7:49pm

    David Lawrence

    41 posts

    I’m having trouble with Pagination displaying the proper current link and number of pagination pages on results generated from the EE2 Query module. Here’s the code that generates the links:

          {exp:query sql="SELECT e.author_id AS author_id, m.screen_name as author FROM exp_channel_titles e INNER JOIN exp_members m ON e.author_id = m.member_id WHERE e.channel_id = 10 GROUP BY author_id ORDER BY author"}
            <li>{if author_id == "1"}{if:else}{author}{/if}</li>
          {/exp:query}


    Here’s the code that sets the pagination atributes:

    {exp:channel:entries channel="{my_channel}” orderby=“date” author_id=”{segment_3}” sort=“desc” limit=“12” disable=“member_data|trackbacks” paginate=“bottom”}

     

    Here’s the code that renders the pagination:

    {paginate}
          <div id=“pagination-links” class=“clearfix”>{pagination_links}</div>
    {/paginate}


    in EE1, the pagination html is rendered as:

    <div id="pagination-links" class="clearfix"><ul><li id="li-open"></li><li><strong>1</strong></li><li><a href="http://www.stretcher.org/archives/author/13/P12/">2</a></li><li><a href="http://www.stretcher.org/archives/author/13/P24/">3</a></li><li><a href="http://www.stretcher.org/archives/author/13/P12/">| Next</a></li><li id="end-pagination"><a href="http://www.stretcher.org/archives/author/13/P336/">| Oldest >>    </a></li><li id="li-close"></li></ul></div>


    in EE2, the pagination html is rendered as:

    <div id="pagination-links" class="clearfix"><ul><li id="li-open"></li><li><a href="http://www.stretcher.org.php5-18.dfw1-1.websitetestlink.com/archives/author/13/P1">Prev |</a></li><li><a href="http://www.stretcher.org.php5-18.dfw1-1.websitetestlink.com/archives/author/13/">1</a></li><li class="active">2</li><li><a href="http://www.stretcher.org.php5-18.dfw1-1.websitetestlink.com/archives/author/13/P24">3</a></li><li><a href="http://www.stretcher.org.php5-18.dfw1-1.websitetestlink.com/archives/author/13/P36">4</a></li><li><a href="http://www.stretcher.org.php5-18.dfw1-1.websitetestlink.com/archives/author/13/P24">| Next</a></li><li id="end-pagination"><a href="http://www.stretcher.org.php5-18.dfw1-1.websitetestlink.com/archives/author/13/P336"> | Oldest >>   </a></li><li id="li-close"></li></ul></div>


    Live examples here:

    EE1 - pagination display works

    http://www.stretcher.org/archives/author/13/


    EE2 - pagination display broken

    http://www.stretcher.org.php5-18.dfw1-1.websitetestlink.com/archives/author/13/


    Any help much appreciated!

    Thanks!
    David

  • #2 / Apr 04, 2011 8:57am

    Sue Crocker

    26054 posts

    Hi, David.

    If you don’t use that bit of exp:query, do your pagination links work as expected in EE2.x?

  • #3 / Apr 04, 2011 11:29am

    David Lawrence

    41 posts

    Hi Sue,

    Yes, all other pagination on the site works perfectly.

    AFAIK, the exp:query statement is required in order to build the list of links of post by author. The links it creates are identical in 1.7.0 and 2.x

    For example:

    http://www.stretcher.org.php5-18.dfw1-1.websitetestlink.com/archives/page/P12/

    renders pagination fine in EE2.x.


    It’s only broken when the URL has /author/ in the URL and only in EE2.x

    For example, his URL is fine in EE1.7.0 and broken in EE2:

    http://www.stretcher.org.php5-18.dfw1-1.websitetestlink.com/archives/author/13/P12/

  • #4 / Apr 06, 2011 3:10am

    David Lawrence

    41 posts

    Sue, et al.,

    Any thoughts on this?

    thanks!

  • #5 / Apr 06, 2011 6:47pm

    Lisa Wess

    20502 posts

    David -

    Can you have a look at this thread and confirm if you are experiencing a similar issue? I looked and they look very similar to me, but I could use your confirmation on that.

  • #6 / Apr 06, 2011 8:16pm

    David Lawrence

    41 posts

    Hi Lisa,

    They are not exactly the same but perhaps they are related?

    In my case, the actual links generated by pagination are correct, however the link set to “current” gets set incorrectly and stays stuck.


    If you look at this example:

    http://www.stretcher.org.php5-18.dfw1-1.websitetestlink.com/archives/author/13/

    notice how you can click the pagination links and get to all the pages (except page 2) but the current link is set at “2” and stays stuck everywhere.


    Does this help clarify the problem?

  • #7 / Apr 06, 2011 8:20pm

    Lisa Wess

    20502 posts

    Yes, that does help.  Thank you David.

    Can you try the same thing I had Kyle try?  Put your query tag into a template with absolutely nothing else.  Just the query tag and required pagination.  This will rule out any template interaction that might be impacting the behavior.

    Thank you!

  • #8 / Apr 06, 2011 8:52pm

    David Lawrence

    41 posts

    Hi Lisa,

    I created a simple test template using this code:

    {preload_replace:my_channel="posts_misc"}
    {preload_replace:my_template_group="embeds"}
    
    HELLO WORLD
    
    
    
    
     {!--author Posts--}
          <ul>
            <li><h3>Authors from Posts</h3><p></li><br />
              {exp:query sql="SELECT e.author_id AS author_id, m.screen_name as author FROM exp_channel_titles e INNER JOIN exp_members m ON e.author_id = m.member_id WHERE e.channel_id = 10 GROUP BY author_id ORDER BY author"}<br />
                <li><a href="http://{path=archives/author/{author_id}}">{if author_id == "1"}{if:else}{author}{/if}</a></li><br />
              {/exp:query}<br />
          </ul>  <br />
    {!--end author posts--}


    The page can be viewed here:

    http://www.stretcher.org.php5-18.dfw1-1.websitetestlink.com/test/index.php

    The query tag generates the correct URLs but the resulting pages all have the same pagination problem.

    Is there another test I can do to help you narrow this?

  • #9 / Apr 07, 2011 10:59am

    Robin Sowell

    13255 posts

    Can you tweak the test code?

    <h3>Authors from Posts</h3>
    
    <p>          {exp:query sql="SELECT e.author_id AS author_id, m.screen_name as author FROM exp_channel_titles e INNER JOIN exp_members m ON e.author_id = m.member_id WHERE e.channel_id = 10 GROUP BY author_id ORDER BY author"}<br />
                <a href="http://{path=archives/author/{author_id}}">{author}</a></p>
    
    <p>{paginate}<br />
    Page {current_page} of {total_pages} pages {pagination_links}<br />
    {/paginate}</p>
    
    <p>          {/exp:query}

    Nothing else on it- let’s triple check things.

    Note- you did say it only happens when the ‘URL has /author/’- correct?  I’ll go setup a quick test myself.

    (The wrong page being bolded does ring bells!)

  • #10 / Apr 07, 2011 1:53pm

    David Lawrence

    41 posts

    Hi Robin,

    I made the tweak you requested. You can see the page here:

    http://www.stretcher.org.php5-18.dfw1-1.websitetestlink.com/test/index.php

    The pagination at the bottom says “Page 1 of 1 pages”. The linked pages all still have the same pagination problem.

    Note- you did say it only happens when the ‘URL has /author/’- correct?  I’ll go setup a quick test myself.

    Yes, this is correct. Thank you for your help!

  • #11 / Apr 08, 2011 2:20pm

    Sue Crocker

    26054 posts

    Hi, David. I’m not seeing the page you linked to in your previous post.. did things start working again, or where are we with this?

  • #12 / Apr 08, 2011 3:00pm

    Robin Sowell

    13255 posts

    I’m not either- but given that I can’t reproduce, I’m thinking I’d like to take a closer look.  Testing with:

    <h3>Authors from Posts</h3>
    
    <p>{exp:query limit="2" sql="SELECT e.author_id AS author_id, m.screen_name as author FROM exp_channel_titles e <br />
    INNER JOIN exp_members m ON e.author_id = m.member_id WHERE e.channel_id != 10 GROUP BY author_id ORDER BY author"}<br />
                <a href="http://{path=archives/author/{author_id}}">{author}</a></p>
    
    <p>{paginate}<br />
    Page {current_page} of {total_pages} pages {pagination_links}<br />
    {/paginate}</p>
    
    <p>          {/exp:query}

    Test url: http://127.0.0.1:8888/213/index.php/news/author/

    It all works as expected for me.  So- dropping you an email, David.  Let’s see if we can delve a little deeper.

  • #13 / Apr 08, 2011 5:10pm

    David Lawrence

    41 posts

    HI Sue and Robin,

    No, things are still not working. Apologies, I had to roll back to a back-up yesterday while dealing with a different bug and forgot to re-upload the the test template.

    Here’s the new link to the test:

    http://www.stretcher.org.php5-18.dfw1-1.websitetestlink.com/test/

    Robin, got you email and will send you my super admin credentials so you can get under the hood.

    thank you!

    UPDATE:

    Robin - I just sent the info via the secure form. Feel free to do what you need. Thanks!

  • #14 / Apr 08, 2011 5:43pm

    David Lawrence

    41 posts

    Robin -

    BTW, the templates you’ll probably be interested in are located here:

    embeds/posts_sidebar
    embeds/archives_author

    test/index

    Also, I should add that the site and DB are entirely backed up so there’s no risk.

  • #15 / Apr 10, 2011 11:55am

    Greg Salt

    3988 posts

    Hi David,

    Thanks very much for your patience whilst we investigate this issue.

    Cheers

    Greg

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

ExpressionEngine News!

#eecms, #events, #releases