Welcome to Geeklog Saturday, November 27 2021 @ 04:17 am EST

Geeklog Forums

adding "hits" in static page display


Status: offline

wfzimmerman

Forum User
Chatty
Registered: 24/10/03
Posts: 50
caffeinated
I want to add the hit count to static pages that are displayed either as centerblocks or as individual page -- next to the "Edit" link for people with edit rights.

I looked at the code and I see where it looks like I need to add something like this:

PHP Formatted Code

 <td align="right">{lang_hits}:</td>
              <td><input type="hidden" name="sp_hits" value="{sp_hits}">{sp_hits}</td>
 


but I can't quite figure out where to put it. What I want is for end users to see the number of hits on a static page, just like they see the number of hits on a story.
 Quote

Status: offline

Euan

Forum User
Full Member
Registered: 22/04/02
Posts: 292
Not sure what the hidden input is for, but look between lines 98 and 111 of staticpages/index.php.

PHP Formatted Code

    if ($A['sp_format'] <> 'blankpage') {
        $curtime = COM_getUserDateTimeFormat ($A['sp_date']);
        $retval .= '<p align="center"><br>' . $LANG_STATIC['lastupdated']
                . ' ' . $curtime[0];
        if ((SEC_hasAccess ($A['owner_id'], $A['group_id'], $A['perm_owner'],
                $A['perm_group'], $A['perm_members'], $A['perm_anon']) == 3) &&
                SEC_hasRights ('staticpages.edit')) {
            $retval .= '<br><a href="' . COM_buildURL ($_CONF['site_admin_url']
                    . '/plugins/staticpages/index.php?mode=edit&sp_id='
                    . $page) . '">';
            $retval .= $LANG_STATIC['edit'] . "</a>";
        }
        $retval .= '</p>';
    }



 


You should be able to fit your code in there to show hits. eg

PHP Formatted Code

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



 


Or something like that?

Cheers,

Euan.
-- Heather Engineering -- No job too small
 Quote

All times are EST. The time is now 04:17 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