PDA

View Full Version : Add Link Stats to Home Statistics


interfx
11-26-2004, 07:10 PM
I tried to add the total number of links into the adv_portal_stats template, as follows - but it does not show the number of links...

This is what I tried, but it doesn't work...

Thanks -
InterFX

$vbphrase[links]: $totallinks

Brian
11-26-2004, 08:49 PM
You would need to add a query to the stats.php file as well...

$totallinks = $DB_site->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "links WHERE valid = 1 AND suspended = 0");

$totallinks = number_format($totallinks['count']);

Our Sponsors
 

interfx
11-26-2004, 09:19 PM
That worked perfect...

You should consider adding this into your next release...

InterFX

dontpanic
10-22-2005, 11:16 PM
Brian, could this be expanded to produce the same results as the stats for vB Galley mod?

Directories: x
Links: x
Posts: x
Total Views x

Our Sponsors
 

Rob Locke
01-15-2006, 02:46 PM
Brian, could this be expanded to produce the same results as the stats for vB Galley mod?

Directories: x
Links: x
Posts: x
Total Views xYes, yes, pretty please! This is just what I am looking for too.

Rob Locke
01-18-2006, 12:33 PM
Well, I tried to add links data to the stats module by comparing the gallery stats module addition with the code from the links index.php, but it doesn't work - I just get a white page. Brian, I have posted my failed attempt below. Please can you suggest what needs to be changed to get it working?require_once('./functions_links.php');

$getlinks = $db->query("
SELECT linkcount, postcount, FROM " . TABLE_PREFIX ."links_categories");

while ($links = $db->fetch_array($getlinks))
{
$tdirs++;
$tlinks += $links['linkcount'];
$tposts += $links['postcount'];
}

$totaldirs = number_format($tdirs);
$totallinks = number_format($tlinks);
$totalposts = number_format($tposts);

$tviews = $db->query_first("SELECT SUM(views) AS tviews FROM " . TABLE_PREFIX . "links");
$totalviews = number_format($tviews['tviews']);

interfx
01-23-2006, 10:16 AM
Did you get this working?

Rob Locke
01-23-2006, 11:57 AM
Sadly no. I am not very PHP savvy. I'm like a visitor in a foreign country - I understand vaguely what the language means but can't speak it. I really wish someone would assist in getting this working. I thought this would be a popular addition and it seems pretty simple for someone who can speak the language.

Rob Locke
01-26-2006, 07:43 PM
Anyone...pleeeeeease??? Really need this.

interfx
01-27-2006, 10:07 PM
I found this link for the old VBaGallery that works with VB3.5....

http://www.photopost.com/forum/showthread.php?t=119449

I think this is close, I'm trying to make it work, but quite yet...

Rob Locke
02-01-2006, 01:30 PM
OK, I applied myself and got this to work. Here's how to do it.

1) Open your cmps_index.php (or whatever you've renamed it).

Find:$phrasegroups = array();
$globaltemplates = array();
$actiontemplates = array();
$specialtemplates = array();Replace it with:$phrasegroups = array('adv_links');
$globaltemplates = array();
$actiontemplates = array();
$specialtemplates = array('links_d_cache');NOTE: If you already have entries in array(); just add...'adv_links',...and...'links_d_cache',...immediately after the first parentheses of $phrasegroups and $specialtemplates respectively.

2) In your forum directory open modules/stats.php.

Find:eval('$home["$mods[modid]"][\'content\'] = "' . fetch_template('adv_portal_stats') . '";');
Above it add:$getlinkcats = $db->query("SELECT linkcount, postcount FROM " . TABLE_PREFIX . "links_categories");
while ($linkcats = $db->fetch_array($getlinkcats))
{
$stats['linkcategories']++;
$stats['links'] += $linkcats['linkcount'];
$stats['linkposts'] += $linkcats['postcount'];
}

$stats['linkcategories'] = number_format($stats['linkcategories']);
$stats['links'] = number_format($stats['links']);
$stats['linkposts'] = number_format($stats['linkposts']);

$getlinkstats = $db->query_first("SELECT SUM(views) AS views FROM " . TABLE_PREFIX . "links WHERE valid = 1");
$stats['linkviews'] = number_format($getlinkstats['views']);Save and upload the file to the server.

3) In your admin control panel go to Styles & Templates > Template Manager and click the «» button to show the templates. In vBadvanced CMPS Templates open adv_portal_stats. At the very end (or wherever you prefer to place it) add:<tr>
<td class="thead"><a href="http://yoursite.com/linksdirectory/$session[sessionurl_q]">$vbphrase[links]</a></td>
</tr>
<tr>
<td class="$bgclass">
<span class="smallfont">$vbphrase[directories]: $stats[linkcategories]<br />
$vbphrase[links]: $stats[links]<br />
$vbphrase[posts]: $stats[linkposts]<br />
$vbphrase[total_views]: $stats[linkviews]<br /></span>
</td>
</tr>Make sure you replace yoursite.com and linksdirectory with your information.

That's it. Enjoy!