Welcome to Geeklog, Anonymous Friday, November 29 2024 @ 11:51 pm EST
Geeklog Forums
adding "hits" in static page display
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:
<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.
I looked at the code and I see where it looks like I need to add something like this:
Text 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.
8
12
Quote
Status: offline
Euan
Forum User
Full Member
Registered: 04/22/02
Posts: 292
Not sure what the hidden input is for, but look between lines 98 and 111 of staticpages/index.php.
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
$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
Text 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
Text 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
8
9
Quote
All times are EST. The time is now 11:51 pm.
- 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