Most popular pages?

Permalink
Is it possible to generate a list of most popular pages in a default block?

 
Mnkras replied on at Permalink Reply
Mnkras
that would be interesting based on number of pageviews, i would like that
okhayat replied on at Permalink Reply
okhayat
I created a custom template for Page List block to do this and display it as a marquee.
You can customize the code and use it as you like.
<?php defined('C5_EXECUTE') or die(_("Access Denied."));
$limit = $num ? $num : 10; // number of pages, page list block
$mrSql = "SELECT cv.cID, COUNT(*) Visits
          FROM CollectionVersions cv
          JOIN Pages p ON cv.cID = p.cID
          JOIN PageStatistics ps ON cv.cID = ps.cID
          WHERE cParentID = $cParentID AND cChildren = 0
          GROUP BY ps.cID
          ORDER BY Visits DESC
          LIMIT $num";
Loader::model('page_list');
$db = Loader::db();
$pageList = $db->execute($mrSql);
?>
<marquee height="10" direction="left" scrolldelay="5" scrollamount="2" onMouseOver='this.stop()' onMouseOut='this.start()'>