Where is clicks value shown? It depends on you but i did to be above of votes count so result looks like this:

You can also see demo (version 0.98) on:
Version 098
And version 0.97 (which is highly customized) on
Version 097 (Customized)
Requirements
- Pligg v 9.7 or 9.8
- Basic PHP,css knowledge
- voting option:1 (default ->NO star voting)
- title as link
-yget template
It is neccesary to use story title as link and open story title in new window. To do that, go to your admin panel-configure Pligg-Story and set both "use story titles as link" and "open story title in new window" to true.
Files:
Place to your templates/yget/images folder

Steps to do:
AA) Go to your phpMyAdmin and run following sql:
Code:
ALTER TABLE your_site_links ADD COLUMN clicks bigint default 1
1)add var clicks:
var $clicks=0;
2) after function store_basic add following function:
PHP Code:
//***************************************
//function storeClicks() save click value
//***************************************
function store_clicks(){
global $db;
$clicks=$this->clicks+1;
$sql = "UPDATE " . table_links . " set `clicks`=$clicks WHERE link_id=".$this->id;
$db->query($sql);
}
PHP Code:
$this->clicks=$link->clicks; //clicks addon
4) find function read_basic() and update query:
PHP Code:
if(($link = $db->get_row("SELECT link_comments, link_author, link_status, link_randkey, link_category, link_date, link_votes, link_karma, link_published_date,clicks FROM " . table_links . " WHERE link_id = $id")))
PHP Code:
$this->clicks=$link->clicks; //clicks addon
PHP Code:
$smarty->assign('link_clicks',$this->clicks);//link clicks addon
B) create a new file in your main folder and name it click_link_count.php. Add following code:
PHP Code:
<?php
// The source code packaged with this file is Free Software, Copyright (C) 2005 by
// Ricardo Galli <gallir at uib dot es>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// [url=http://www.affero.org/oagpl.html]affero.org: affero general public license[/url]
// @author AnAlienHolakres3
if($_POST['link_id']){
include_once('Smarty.class.php');
$main_smarty = new Smarty;
include('config.php');
include(mnminclude.'link.php');
include(mnminclude.'html1.php');
include(mnminclude.'smartyvariables.php');
$link = new Link;
//initialize Link and set ID
$link->id=$_POST['link_id'];
//read Link information
$link->read_basic();
$value = $_POST['value'];
//save new clicks value
$link->store_clicks();
}
?> C)Open xmlhttp.php in your js folder. We need to add some javascript function,so before vote function add this:
Code:
function sendClickedValue(link_id,htmlid) {
var value;
if(document.all){
value=parseInt(document.getElementById('click_count-'+link_id).innerText)+1;
document.getElementById('click_count-'+link_id).innerText=value;
} else {
value=parseInt(document.getElementById('click_count-'+link_id).textContent)+1;
document.getElementById('click_count-'+link_id).textContent=value;
}
url = "<?php echo $my_base_url.$my_pligg_base; ?>/click_link_count.php";
mycontent = "link_id=" + link_id;
mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
if (mnmxmlhttp) {
mnmxmlhttp[htmlid].open ("POST", url, true);
mnmxmlhttp[htmlid].setRequestHeader ('Content-Type', 'application/x-www-form-urlencoded');
mnmxmlhttp[htmlid].send (mycontent);
}
}
D)Open link_summary.tpl in your templates/template/ folder.
1)after {if $Voting_Method eq 1} in the beginning add this code:
PHP Code:
<div class="click_count" id="click_count-{$link_id}" >{$link_clicks}</div>
PHP Code:
onclick="sendClickedValue({$link_id},{$link_shakebox_index});"
E) open your main.css in your templates/template/css folder
Please note that this you should customize to your own needs.Add this class:
Code:
.click_count{font-size:7pt;width:54px;text-align:center;color:white;font-weight:bold;position:relative;z-index:1}
We made some customization in link_summary.tpl,remember? The little problem is that javascript used when voting replace our code and in some browsers (for example Opera) votebox is completely distorted. To avoid this we need to make one more customization:
open xmlhttp.php in your js folder and find function changemnmvalues (id, value, error).
Then, replace original code:
Code:
target1.innerHTML = b[0];
Code:
if(document.all){
value=parseInt(document.getElementById('xvotes-' + id).innerText)+1;
document.getElementById('xvotes-' + id).innerText=value;
} else {
value=parseInt(document.getElementById('xvotes-' + id).textContent)+1;
document.getElementById('xvotes-' + id).textContent=value;
}
G) The core of this is done but current votebox image is not suitable for our purposes.
Open main.css in your templates/yget folder and do following:
1) find .news-upcoming and change vote.png to vote2.png
2) add following class:
Code:
.click_count{font-size:7pt;width:54px;text-align:center;color:white;font-weight:bold;position:relative;z-index:1}
change line-height to 55px
4) add class:
Code:
.vote {
margin-top:-7px
}
1) find .news-upcoming2 and change vote-l.png to vote-l2.png
This is not absolutely clean so feel free to customize it

Thats all. Hope it works for you







Linear Mode




