Fork me on GitHub

Top List Broken after Upgrade?  Bottom

  • We've just upgraded from the last and latest version of PostNuke to the latest version of Zikula. There are a few problems that have popped up. This one isn't very important so I'll post it in this thread and the other in another so other users will be able to find it easier on here.

    It seems the Top List module is broken since our upgrade. The page listing all the popular items lists every article, over 800 articles. I did change the settings in admin to list only 10 of the most popular items per category and the page says 10 most read stories.


    Also each link is re-directed to the first news article page, as opposed to its corresponding individual article link. You can take a peek at the page I'm talking about here:

    http://www.animatecl…Top_List&file=index

    I searched this site but it seems nobody else has this issue, is there something obvious we missed?
  • Not sure if or how it works, but you might look at TopList. (It looks like you have to get it from SVN)



    edited by: craigh, Jul 02, 2009 - 11:26 AM
  • looking at the code for Top_List that is included with the Migration Distribution, it looks like the value is stored but never used to limit the results.
  • just shooting in the dark here, but you could trying changing

    Code

    ORDER BY $column[counter] DESC";


    to

    Code

    ORDER BY $column[counter] DESC LIMIT ".$top;


    this is all in modules/Top_List/pnuser.php

    you'll need to change every instance of a SQL call - so the column name would be different than the example above.

    UNTESTED! icon_smile
  • Thank you craigh, that fix is probably a job for my friend who is more advanced then me with editing code. But we'll give it a shot. I noticed one error that I would think could be easily fixed. It seems when you start at the Top List page...

    http://www.animatecl…p?module=Top%20List

    When you click a news article link it queries a link like this:

    http://www.animateclay.com/index.php?name=News&file=article&sid=827

    But the query should be directed to:

    http://www.animateclay.com/index.php?module=News&func=display&sid=827

    The text "file=article" shoud be "func=display".

    I've searched over all the top list text documents and don't see any instance of the word "article" except when it comes to the text for the articles headline for that page.

    I have a feeling I'm looking in the wrong place. Could it be that it's this pnuser.php code that needs to be altered?

    Code

    * Top 10 articles in special sections
             */
            $column = $pntable['seccont_column'];
            $myquery = "SELECT $column[artid], $column[secid], $column[title], $column[content], $column[counter]
                        FROM $pntable[seccont] ".$queryslang."
                        ORDER BY $column[counter] DESC";




    edited by: animateclay, Jul 02, 2009 - 05:18 PM
  • nope - you want to edit the template.

    in Top_List/pntemplates/toplist_user_main.htm change

    Code

    <a href="index.php?name=News&amp;file=article&amp;sid=<!--[$story.sid]-->"><!--[$story.title]--></a>

    to

    Code

    <a href="index.php?name=News&amp;func=display&amp;sid=<!--[$story.sid]-->"><!--[$story.title]--></a>


    probably icon_wink
  • Thank you again craigh, yes it fixed the links! While the page is ugly, for now at least it is mostly functional. I appreciate all your help! icon_wink
  • the edit to the SQL above isn't all the complicated. just back up your file and give it a shot. you can always put back the original! get your hands dirty icon_wink
  • I gave it a shot - and it worked! Thanks for kicking me in the butt, it wasn't that hard to do at all. icon_lol
  • awesome! knew you could do it. icon_smile
  • BTW the original script TopList was based on is still in active development: http://www.aardvarktopsitesphp.com/.
    If someone has time, it might be nice to check out the new code and update TopList where needed.

    --
    campertoday.nl, Module development, Dutch Zikula Community

This list is based on users active over the last 60 minutes.