We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27697
    • 11 Posts
    Cool. Thanks, all, for the proper guidance.

    This works for me (no private, no unpublished, table_prefix used):

    $prefix = $modx->dbConfig['table_prefix'];
    
    $sql = "SELECT " . $prefix . "site_content.pagetitle, count(" . $prefix . "log_access.document) AS totalView," . $prefix . "log_access.document "
    ."FROM " . $prefix . "log_access INNER JOIN " . $prefix . "site_content ON " . $prefix . "log_access.document=" . $prefix . "site_content.id "
    ."WHERE " . $prefix . "site_content.published=1 AND " . $prefix . "site_content.privateweb=0 "
    ."GROUP BY " . $prefix . "log_access.document ORDER BY totalView desc limit $numPages;";
    
      • 6726
      • 7,075 Posts
      This is really cool guys thanks !
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l'outil id
        • 34162
        • 1 Posts
        Yeah! One of the most sophisticated SQL-statements I’ve seen for years!!
        cool
          • 25663 MODX Staff
          • 12,272 Posts
          What happens if the built in stats changes (hint)?
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 22815
            • 1,097 Posts
            A discussion started here that is not directly related to this snippet. It has been moved to
            "Time is not on our side".

            I’ve already mentioned the likelihood of stats changing, and might remind people that not everyone using the current MODx is using the default stats - there has been an alternative available for some time.

            Essentially, the table references would probably change. Or something. In any event, anyone who is using a different stats module may still find this snippet a good starting point.
              No, I don't know what OpenGeek's saying half the time either.
              MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
              Forum: Where to post threads about add-ons | Forum Rules
              Like MODx? donate (and/or share your resources)
              Like me? See my Amazon wishlist
              MODx "Most Promising CMS" - so appropriate!