PDA

View Full Version : hows does link clicks counter works ?


jbgscalex
03-21-2007, 05:36 PM
Hi,
does the link click counter has do to with Cron job or anything like that ?
or are they totaly independent from anything and update by their self ?

And do they update on every link click or once a day ?

thank you
jb

Dave Baker
03-21-2007, 07:34 PM
Hello jbgscalex,
If you will look over your view-link.tpl or another .tpl file where is placed code for forming a url address you will find code for a link url like this:

<a href="{$link.url}" class="title" id="l{$link.id}" {if $config.new_window}target="_blank"{/if}>{if $config.html_tags}{$link.title}{else}{$link.title| escape:"html"}{/if}</a>

In your footer.tpl there's code(function) like this:

function count_link()
{
// l = link, b = banner
var tp = this.id.charAt(0);
if(tp != 'l' && tp != 'b')
{
return true;
}
if(this.id.length < 2)
{
return true;
}
itemid = this.id.substring(1);
if(parseInt(itemid.charAt(0)) < 1 || itemid.match(/\D/))
{
return true;
}
i = new Image();
h = Math.random();
i.src= root + 'click-count.php?id='+itemid+'&type='+tp+'&;h='+h;
return true;
}

When you will click on a link url, this function will start up code in the file click-count.php and pass the link "id". The code in click-count.php execute query and increase count of your link clicks.

jbgscalex
03-22-2007, 08:12 AM
now I understand, thank you Dave.
jb

Dave Baker
03-23-2007, 04:36 PM
Always at your services!

PHP.Bourne
01-10-2008, 11:43 AM
I modify below code
in regular-listing-display.tpl

{if $config.mod_rewrite}
<a href="{$config.base}{$config.dir}{$listing.path}{convert Str string=$listing.title}-l{$listing.id}.html"><img src="{$img}info_16.png" alt="{$lang.listing_details}" title="{$lang.listing_details}" /></a>
{else}
<a href="{$config.base}{$config.dir}view-listing.php?id={$listing.id}" rel="nofollow"><img src="{$img}info_16.png" alt="{$lang.listing_details}" title="{$lang.listing_details}" /></a>
{/if}


to

{if $config.mod_rewrite}
<a href="{$config.base}{$config.dir}{$listing.path}{convert Str string=$listing.title}-l{$listing.id}.html"><img src="{$img}info_16.png" alt="{$lang.listing_details}" title="{$lang.listing_details}" id="l{$listing.id} /></a>
{else}
<a href="{$config.base}{$config.dir}view-listing.php?id={$listing.id}" rel="nofollow"><img src="{$img}info_16.png" alt="{$lang.listing_details}" title="{$lang.listing_details}" id="l{$listing.id} /></a>
{/if}

When user click on detail link, count_link() function be run.
I want run count_lnk() dunction whenever refresh the listing page view.
everyone help me?

Dave Baker
01-18-2008, 12:45 PM
Hello PHP.Bourne,
***Open click-count.php and find code***

if ($_GET['type'] == 'l')
{
include(dirname(__FILE__).DIRECTORY_SEPARATOR.'inc ludes'.DIRECTORY_SEPARATOR.'header-lite.php');
$config->factory("Listing");
if ($esynListing->exists("`id`='".$id."'") && !$esynListing->checkClick($id, $ip))
{
$esynListing->click($id, $ip);
}
}

***Replace with***

if ($_GET['type'] == 'l')
{
include(dirname(__FILE__).DIRECTORY_SEPARATOR.'inc ludes'.DIRECTORY_SEPARATOR.'header-lite.php');
$config->factory("Listing");
$esynListing->click($id, $ip);
}

**Save file***

PHP.Bourne
01-18-2008, 09:48 PM
Thanks :cool-yo:

Dave Baker
01-21-2008, 04:27 AM
You are welcome!