Welcome to Geeklog, Anonymous Wednesday, August 17 2022 @ 08:38 am EDT

Geeklog Forums

stats staticpages


Status: offline

d404

Forum User
Chatty
Registered: 01/21/05
Posts: 41
i want print in staticpages the numbers of visits for it

i found this IN functions.inc OF Static Pages Plugin 1.4.2

Text Formatted Code


/**
* Shows the statistics for the Static Pages plugin on stats.php.
* If $showsitestats is 1 then we are to only print the overall stats in the
* 'site statistics box' otherwise we show the detailed stats
*
* @param    int     showsitestate   Flag to let us know which stats to get
*/
function plugin_showstats_staticpages($showsitestats)
{
    global $_CONF, $_TABLES, $LANG_STATIC;
    $retval = '';

    $perms = SP_getPerms ();
    if (!empty ($perms)) {
        $perms = ' AND ' . $perms;
    }
    $result = DB_query ("SELECT sp_id,sp_title,sp_hits FROM {$_TABLES['staticpage']} WHERE sp_hits > 0" . $perms . ' ORDER BY sp_hits DESC LIMIT 10');
    $nrows  = DB_numRows ($result);
    if ($nrows > 0) {
        require_once( $_CONF['path_system'] . 'lib-admin.php' );
        $header_arr = array(
            array('text' => $LANG_STATIC['stats_page_title'], 'field' => 'sid'),
            array('text' => $LANG_STATIC['stats_hits'], 'field' => 'sp_hits'),
        );
        $data_arr = array();
        $text_arr = array('has_menu'     => false,
                          'title'        => $LANG_STATIC['stats_headline'],
        );
        for ($i = 0; $i < $nrows; $i++) {
            $A = DB_fetchArray ($result);
            $A['sp_title'] = stripslashes ($A['sp_title']);
            $A['sid'] = "<a href=\"" . COM_buildUrl ($_CONF['site_url']
                      . "/staticpages/index.php?page={$A['sp_id']}"). "\">{$A['sp_title']}</a>";
            $A['sp_hits'] = COM_NumberFormat ($A['sp_hits']);
            $data_arr[$i] = $A;
        }
        $retval .= ADMIN_simpleList("", $header_arr, $text_arr, $data_arr);
    } else {
        $retval .= COM_startBlock ($LANG_STATIC['stats_headline']);
        $retval .= $LANG_STATIC['stats_no_hits'];
        $retval .= COM_endBlock();
    }

    return $retval;
}

 


HOW I can do this ?
 Quote

tokyoahead

Anonymous
you would have to edit the index.php in your /public_html/staticpages/index.php to display $A['sp_hits'], maybe next to the last updated date.
 Quote

Status: offline

d404

Forum User
Chatty
Registered: 01/21/05
Posts: 41
Quote by tokyoahead: you would have to edit the index.php in your /public_html/staticpages/index.php to display $A['sp_hits'], maybe next to the last updated date.


yeah Big Celebration

for those who want do same as me this is code


go to the

/public_html/staticpages/index.php

find

Text Formatted Code
$retval .= '<p align="center"><br>' . $LANG_STATIC['lastupdated']. ' ' . $curtime[0];
 


replaces with

Text Formatted Code

$retval .= '<p align="center"><br>' . $LANG_STATIC['lastupdated']
                . ' ' . '<br>' . $curtime[0] . '<br>' .$LANG_STATIC['stats_hits'] . ' ' . '<br>' .$A['sp_hits'];

 
 Quote

All times are EDT. The time is now 08:38 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content