Loading...
 
Features / Usability

Features / Usability


Diaplaying most popular pages in last 7 days

posts: 55

Currently I have {MODULE(module=>top_pages,max=>20)}{MODULE} on our front page and this displays a list of the most popular 20 pages and hits.

I would like to dispaly a list of the most popular pages in the last 7 days to more accurately reflect recent activity ... can I pass an argument to the module which will do this.

What I am lookign for is shown in on the STATS pages > MOST POPULAR IN THE LAST 7 DAYS

PeterE

posts: 80 Austria

Q&D solution is to modify in lib/tikilib.php around line 2878:

function get_top_pages($limit) {
        $query = "select `pageName` , `hits`
            from `tiki_pages`
            order by `hits` desc";

to

function get_top_pages($limit,$Days) {
        if (isset($Days)) {
        $query = "select `pageName` , `hits`
            from `tiki_pages`
            where  `lastModif` > (unix_timestamp(now()) -(86400 * $Days))
            order by `lastModif` desc";
        } else {        $query = "select `pageName` , `hits`
            from `tiki_pages`
            order by `hits` desc";
         }

and change line 9 in modules/mod-top_pages.php

$ranking = $tikilib->get_top_pages($module_rows, $module_params["maxdays"]);

Then you can call the module with

{MODULE(module=>top_pages,maxdays=>7,max=>20)}{MODULE}