Jump to content

Hanna Code & Page numbers (possible bug)?


GuruMeditation
 Share

Recommended Posts

Hi all,

I'm having a weird problem with Hanna Code on a page that has Allow Page Numbers? checked in the template settings. If I don't have that setting checked, everything works as expected.

So, I have a template called article_full which is attached to all article pages. It displays the full article and I use Hanna Code to show a list of recent articles in a side block within that template.

Why do I need Allow Page Numbers active? Well basically I have my own comments system in place, and all the comments for that page are displayed at the bottom of the article. I need it active for the pagination for these comments.

The problem?

If I disable Allow Page Numbers, the block of recent articles will be displayed correctly. If I enable Allow Page Numbers and go to page2 of the comments at the bottom, the recent articles are not displayed.

Below is my Hanna Code, which is simple enough.

<?php 
$articles = $pages->find("template=article_full, limit=5, sort=-created");
echo "<ul>";
foreach($articles as $article) {
    echo "<li>" .
         "<a href='{$article->url}'>{$article->title}</a>" .
         "</li>";
}
echo "</ul>";

Now I have a rough idea as to what is going wrong, but I have no idea as to why. Possible bug?

Notice the limit here is 5. So that will pull a maximum of 5 articles for the recent articles block. But I currently only have 4 test articles, so it displays those 4 as expected. But if I now go to page2 via the comments, the recent articles block is empty. It's like the Hanna Code continues on from the last article found, rather than running the code from fresh. I can confirm this by changing the limit to 2. As expected, the main article page displays two articles in the recent articles block, which I will refer to as art1 and art2. Now if I go to page2 I get art3 and art4, rather than art1 and art2 as expected.

I can't see anything wrong with my code, so I assume there is some kind of conflict with page numbers and Hanna Code?

Cheers.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...