Webmastersite.net
Register Log In

LINKTIME

Comments on LINKTIME

mx3design
Member

Usergroup: Customer
Joined: May 30, 2007

Total Topics: 12
Total Comments: 45
Posted Jun 19, 2008 - 1:16 PM:

Paul could you tell me what {LINKTIME} is please: is it a UNIX timestamp for the date a link was added? Or is it the time passed since a link was added. Is it a fixed value or does it alter upon edit?

Thanks, I'm writing a snippet that estimates or projects the number of visits a link is likely to receive over a 12 month period. I'll post it when completed.
mx3design
Member

Usergroup: Customer
Joined: May 30, 2007

Total Topics: 12
Total Comments: 45
Posted Jun 20, 2008 - 3:23 AM:

I assumed {LINKTIME} is timestamp when link added so here is a snippet to calculate estimated hits over a year for a link.

(1) $average is the site link hit average; the first month typically doesn't produce an accurate result.

(2) a balancing factor to increase accuracy has been added to the $mga = ceil.. string. Remove or alter the +100 figue at the string end accordingly.

(3) After a year the actual hits will be displayed.



<?php

$linktime = {LINKTIME};
$linkhits = {LINKHITS};
$time = time();
$average = ceil({TOTALHITS} / {TOTALLINKS}) ;

$ma = 2629743;
$mb = 5259487;
$mc = 7889231;
$md = 10518975;
$me = 13148719;
$mf = 15778463;
$mg = 18408206;
$mh = 21037950;
$mi = 23667694;
$mj = 26297438;
$mk = 28927182;

$mba = ceil(($linkhits / 2) * 12) + 110;
$mca = ceil(($linkhits / 3) * 12) + 100;
$mda = ceil(($linkhits / 4) * 12) + 90;
$mea = ceil(($linkhits / 5) * 12) + 80;
$mfa = ceil(($linkhits / 6) * 12) + 70;
$mga = ceil(($linkhits / 7) * 12) + 60;
$mha = ceil(($linkhits / 8) * 12) + 50;
$mia = ceil(($linkhits / 9) * 12) + 40;
$mja = ceil(($linkhits / 10) * 12) + 30;
$mka = ceil(($linkhits / 11) * 12) + 20;

if ($time - $linktime <= $ma) { echo "$average"; }
else if (($time - $linktime > $ma) && ($time - $linktime <= $mb)) { echo "$mba"; }
else if (($time - $linktime > $mb) && ($time - $linktime <= $mc)) { echo "$mca"; }
else if (($time - $linktime > $mc) && ($time - $linktime <= $md)) { echo "$mda"; }
else if (($time - $linktime > $md) && ($time - $linktime <= $me)) { echo "$mea"; }
else if (($time - $linktime > $me) && ($time - $linktime <= $mf)) { echo "$mfa"; }
else if (($time - $linktime > $mf) && ($time - $linktime <= $mg)) { echo "$mga"; }
else if (($time - $linktime > $mg) && ($time - $linktime <= $mh)) { echo "$mha"; }
else if (($time - $linktime > $mh) && ($time - $linktime <= $mi)) { echo "$mia"; }
else if (($time - $linktime > $mi) && ($time - $linktime <= $mj)) { echo "$mja"; }
else if (($time - $linktime > $mj) && ($time - $linktime <= $mk)) { echo "$mka"; }
else { echo "$linkhits"; }

?>





There's probably an easier or more logical way to do this but it works and may be of use to someone.
mx3design
Member

Usergroup: Customer
Joined: May 30, 2007

Total Topics: 12
Total Comments: 45
Posted Jun 20, 2008 - 12:56 PM:

This revision is probably better, based upon {LINKDAYSOLD}:

<?php

$linkdaysold = {LINKDAYSOLD};
$linkhits = {LINKHITS};
$average = ceil({TOTALHITS} / {TOTALLINKS}) ;

$ma = 30;
$mb = 60;
$mc = 90;
$md = 120;
$me = 150;
$mf = 180;
$mg = 210;
$mh = 240;
$mi = 270;
$mj = 300;
$mk = 330;
$ml = 360;

$mba = ceil(($linkhits / 2) * 12) + 110;
$mca = ceil(($linkhits / 3) * 12) + 100;
$mda = ceil(($linkhits / 4) * 12) + 90;
$mea = ceil(($linkhits / 5) * 12) + 80;
$mfa = ceil(($linkhits / 6) * 12) + 70;
$mga = ceil(($linkhits / 7) * 12) + 60;
$mha = ceil(($linkhits / 8) * 12) + 50;
$mia = ceil(($linkhits / 9) * 12) + 40;
$mja = ceil(($linkhits / 10) * 12) + 30;
$mka = ceil(($linkhits / 11) * 12) + 20;
$mla = ceil($linkhits + 10);

if ($linkdaysold <= $ma) { echo "$average"; }
else if (($linkdaysold > $ma) && ($linkdaysold <= $mb)) { echo "$mba"; }
else if (($linkdaysold > $mb) && ($linkdaysold <= $mc)) { echo "$mca"; }
else if (($linkdaysold > $mc) && ($linkdaysold <= $md)) { echo "$mda"; }
else if (($linkdaysold > $md) && ($linkdaysold <= $me)) { echo "$mea"; }
else if (($linkdaysold > $me) && ($linkdaysold <= $mf)) { echo "$mfa"; }
else if (($linkdaysold > $mf) && ($linkdaysold <= $mg)) { echo "$mga"; }
else if (($linkdaysold > $mg) && ($linkdaysold <= $mh)) { echo "$mha"; }
else if (($linkdaysold > $mh) && ($linkdaysold <= $mi)) { echo "$mia"; }
else if (($linkdaysold > $mi) && ($linkdaysold <= $mj)) { echo "$mja"; }
else if (($linkdaysold > $mj) && ($linkdaysold <= $mk)) { echo "$mka"; }
else if (($linkdaysold > $mk) && ($linkdaysold <= $ml)) { echo "$mla"; }
else { echo "$linkhits"; } ?>
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Jun 21, 2008 - 3:19 AM:

time is the timestamp and never changes. On edit, the lastedit field changes.

$average is the directory's average, not the particular link's average? Not sure what all those comparisons are for.
mx3design
Member

Usergroup: Customer
Joined: May 30, 2007

Total Topics: 12
Total Comments: 45
Posted Jun 22, 2008 - 6:38 AM:

It's is probably only useful if you're selling links, offering a trial period and want to show the potential number of hits a link can expect to receive over a period of 12 months. Where I've deployed it it shows the member the actual hits and alongside the estimated hits (based on the links actual hits received) if the link were to run for a year. The site average appears for the first month as low number of hits can't produce an accurate estimate.
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



Sorry, you don't have permission to post posts. Log in, or register if you haven't yet.