Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-02-2007, 04:51 PM
Pligg Donor
 
Join Date: Mar 2007
Posts: 54
Thanks: 7
Thanked 1 Time in 1 Post
counting clicks instead of votes

i want to have my site count clicks instead of votes. I know there was a thread on this but it was back in February and when i tried it, well the code has changed a bit since then. Does anyone have an updated hack for this?
Reply With Quote
  #2 (permalink)  
Old 06-03-2007, 11:31 AM
Casual Pligger
 
Join Date: Mar 2007
Location: Salem, Oregon
Posts: 51
Thanks: 18
Thanked 0 Times in 0 Posts
Send a message via Skype™ to harlem
Yes, I agree. My site has a couple hundred unique hits a day but none bother to vote on the content. Habitually, once you are off the main site having found what you need it is rare that they come back. This makes voting almost irrelevant. A passive voting method would be beneficial to many sites struggling to get users to vote.
Reply With Quote
  #3 (permalink)  
Old 06-12-2007, 12:30 AM
New Pligger
 
Join Date: Jun 2007
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
That's a great idea. I would like to use that feature as well.
Reply With Quote
  #4 (permalink)  
Old 06-19-2007, 11:16 PM
P1mpPanther's Avatar
Constant Pligger
 
Join Date: Feb 2007
Posts: 292
Thanks: 47
Thanked 10 Times in 9 Posts
hmmm, figured someone would have responded to this by now.

anyone?
__________________
RunStream :: RSS feed creator | RSS Marketing Platform | TagBlast!

...and a Pligg site on deck!
Reply With Quote
  #5 (permalink)  
Old 06-19-2007, 11:21 PM
Casual Pligger
 
Join Date: Mar 2007
Posts: 76
Thanks: 9
Thanked 0 Times in 0 Posts
I think is possible and not very hard because you already have the pageview count. Let me see if I can find something, I would love to have this functionality too.
Reply With Quote
  #6 (permalink)  
Old 06-20-2007, 12:33 AM
Constant Pligger
 
Join Date: Feb 2007
Posts: 236
Thanks: 20
Thanked 29 Times in 15 Posts
im not sure I understand what you guys are trying to do. are you guys trying to count the number of times a user clicks on the story link and eliminate the vote box?

if this is what you guys are trying to do, there is a way to do this ( i think ). but i'll wait for someone to answer if im on the right path before sharing my thought.
Reply With Quote
  #7 (permalink)  
Old 06-20-2007, 02:38 AM
P1mpPanther's Avatar
Constant Pligger
 
Join Date: Feb 2007
Posts: 292
Thanks: 47
Thanked 10 Times in 9 Posts
hey gary - thats how i understand it as well.

clicks for a story (or essentially views) will advance the vote counter.
__________________
RunStream :: RSS feed creator | RSS Marketing Platform | TagBlast!

...and a Pligg site on deck!
Reply With Quote
  #8 (permalink)  
Old 06-20-2007, 04:09 AM
Constant Pligger
 
Join Date: Feb 2007
Posts: 236
Thanks: 20
Thanked 29 Times in 15 Posts
well, you see, if you guys want to achieve this. it should be extremely easy. it only involves taking the url for the vote button (the one that says: "VOTE") to the story article link.

the only downside to this is that if people linked from another website to one of your pligg stories, the vote would not be counted because, technically, they didn't click on that story, instead, they entered the url and jumped directly to the story. if you get my drift.

if people really want this piece of easy modification, then i can post the steps to doing this here.
Reply With Quote
  #9 (permalink)  
Old 06-20-2007, 01:27 PM
Genghis's Avatar
Casual Pligger
 
Join Date: Mar 2007
Posts: 59
Thanks: 9
Thanked 0 Times in 0 Posts
Yes!

abcdefgary, if you could post the steps on how to do this for pligg 9.5 beta...well, I would really appreciate it!
Reply With Quote
  #10 (permalink)  
Old 06-20-2007, 02:44 PM
ozo ozo is offline
Casual Pligger
 
Join Date: Jan 2007
Posts: 50
Thanks: 5
Thanked 7 Times in 5 Posts
Couting Number of clicks - how to

Hey I implemented a way to do this but I don't vouch that this is the best way to do it, but it worked for me @ www.meshedlinks.com, you can see it in action. Follow this steps - however this requires that you have a little, just a little, technical knowledge:

1. create a field in your pligg_links table to store the number of clicks (NOTE: I guess this can be done simply by using extrafields, but I guess someone can work on this solution and have something better)
To create field in your pligg_links table execute this against your database :
ALTER TABLE pligg_links ADD COLUMN clicks BIGINT DEFAULT 1;

2. Modify link.php (in libs folder as follows):
a. add var $clicks = 1; just after var $current_user_reports = 0;
b. replace this:
$db->query("UPDATE " . table_links . " set link_summary='$link_summary', link_title_url='$link_title_url', link_url='$link_url', link_url_title='$link_url_title', link_title='$link_title', link_content='$link_content', link_tags='$link_tags', link_field1='$link_field1', link_field2='$link_field2', link_field3='$link_field3', link_field4='$link_field4', link_field5='$link_field5', link_field6='$link_field6', link_field7='$link_field7', link_field8='$link_field8', link_field9='$link_field9', link_field10='$link_field10', link_field11='$link_field11', link_field12='$link_field12', link_field13='$link_field13', link_field14='$link_field14', link_field15='$link_field15', clicks='$clicks' WHERE link_id=$this->id");
with the $db->query you have in the store function. or alternatively just include ,clicks='$clicks' after $link_field15 in the $db->query function in the store function.
c. In the read function look for if($link) and at the end of it where you have $this->link_summary = $link->link_summary; include $this->clicks = $link->clicks; just below it.
d. In read_basic function replace the $db->get_row.... by $db->get_row("SELECT 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"))) OR simply append , clicks to $db->get row just after link_published_date
e. add $this->clicks=$link->clicks; just after $this->published_date=unixtimestamp($date); still in read_basic
f. add this entry : $smarty->assign('clicks', $this->clicks); just after $smarty->assign('link_category', $this->category_name());
That is all for that file

3. Open out.php in your pliggroot directory. include this:
$db->query("UPDATE " . table_links . " SET clicks = clicks + 1 WHERE link_id = " . $id); just before header("HTTP/1.1 301 Moved Permanently");

4. open up link_summary.tpl in your templates directory and include this:
<span class="clicks">
Views : {$clicks}
</span>
where you want the clicks to be displayed. In your css fine you can define how it should look by creating an entry class clicks and defining it.

Well, that is about it. As I said this is my solution. I am certain there can be an optimized version, but this method does get things to work. Remember you can check it out at www.meshedlinks.com

Am working on displaying and viewing links by votes. So for instance you have a tab at the top that says top links by votes or upcoming links by votes, if you get what I mean.

If you have any questions don't hesitate to post them.
__________________
Meshedlinks - Africa Web 2.0 Bookmarking Service Africa's top web 2.0 social bookmarking community presenting the best links from across the continent
Reply With Quote
The Following 3 Users Say Thank You to ozo For This Useful Post:
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
[mod] count clicks instead of votes abcdefgary Modification Tutorials 8 06-14-2008 11:34 PM
News based on Clicks instead of Votes mde05 Modification Tutorials 2 01-14-2008 08:32 AM
users total votes? inggenia General Help 2 07-09-2007 07:44 AM
Counting Clicks instead of Votes kahunabear Modification Tutorials 13 04-03-2007 09:18 AM
Registering Clicks instead of Votes kahunabear General Help 2 02-01-2007 06:50 PM


Search Engine Friendly URLs by vBSEO 3.2.0