views:

32

answers:

2

I need to set up a community web site to allow people to share binary files in some specific binary format. Files will be visible to everyone. I want users to be able to vote and leave comments about files I also want to count downloads.

I'm googling for CMS that does just that, or plug-in for Joomla or Wordpress or Drupal, but I cannot see anything close.

I have enough expertise to adapt a plug-in for my needs, but I would prefer not to write it from the scratch.

Could you please suggest something?

A: 

I would say to write it from scratch although you don't want to...

I would make a plain text file that holds the values on the votes and the total number like this- Say there's three votes; A 3 star, a 4 star and a 5 star. Make a file like this...

12
3

Then read it into and array by line...

$values = file('rating.txt');

After that get the average...

$rating = $values[0]/$values[1];
//Do whatever you want from here

To add a vote, just do...

$rating = $_POST['rating'];
if ($rating > 5) $rating = 5;
$values = file('rating.txt');
$total = $rating + $values[0];
$votes = $values[1]++;
$data = $total."\n".$votes;
$fp = fopen('rating.txt', 'w+');
fwrite($fp, $data);
fclose($fp);
Mark
A: 

As you mentioned you are accepting either Joomla/WordPress, there is a plugin that does just that: Download Monitor.

mhitza
Thanks, that's what I need.
Konstantin