Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: [archived] tcm_rating: TXP Rating System
I’ll have to try this out on an upcoming site I’m working on. Would it be easy to create a list of the top rated articles with the data from this plugin? Thanks.
Offline
Re: [archived] tcm_rating: TXP Rating System
i’m with chris… Any way that someone could write a plugin to return the top ‘n’ ratings in an ordered list with some options?
Offline
Re: [archived] tcm_rating: TXP Rating System
anybody?
Offline
Re: [archived] tcm_rating: TXP Rating System
it’s possible, of course (a little processor-heavy), but honestly it will take some work. Here are just a few starters
The gist of it:
<pre>
change this line so that it gets all ratings
$ratings = safe_rows(“rating”, “txp_tcm_ratings”, “parentid = $id”);
like so
$ratings = safe_rows(“rating”, “txp_tcm_ratings”, “ORDER BY parentid”);
—————————————————————————
Process each parentid one by one – you will have to make $total an array, or create a new array that takes each $total value after the quick computations are done
—————————————————————————-
After you have an array of $parentids and $totals, copy a lot of the code from “publish.php”‘s “doArticles” function and after that returns an array of articles, sort that array (via one of the php array_sort functions) by the rating.
</pre>
That’s my “pseudocode” explanation on how to do it.
Offline
Re: [archived] tcm_rating: TXP Rating System
wow that sucks… forget that idea i guess :-\
perhaps it would be easier just to sort by date and find the most recent rated… even though that defeats the purpose of what I wanted to do.
Offline
Re: [archived] tcm_rating: TXP Rating System
Maybe a suggestion for a new version of this plugin would be to do the math while saving to the database. If this were to work, instead of saving each rating separately, the database would have one table for each article and have a section for IPs, number of ratings and average rating. Wouldn’t this be a lot faster in the end and allow for things like the x-amount of top rated articles?
Offline
#37 2005-01-15 03:37:53
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: [archived] tcm_rating: TXP Rating System
I don’t know much about the plugin’s code, but why not use something like this:
SELECT *, avg(rating) as average from txp_tcm_ratings GROUP BY parentid ORDER BY average DESC.
No need to do the math in PHP or in advance.
Alex
Offline
Re: [archived] tcm_rating: TXP Rating System
wow, nice! i’ll see what i can do with that (should be pretty simple now). sql really is my achille’s heel.
Offline
Re: [archived] tcm_rating: TXP Rating System
programming is my achille’s heel. all i really can do is XHTML + CSS
Offline
Re: [archived] tcm_rating: TXP Rating System
Yeah, I’m interested in having an automated Top Rated Articles to work with this plugin. I guess for now I’ll have to do it manually.
Offline
Re: [archived] tcm_rating: TXP Rating System
Since I upgraded to RC3, all my ratings output numbers are 0. Not really sure what the problem is — it was working fine with RC1, I don’t know what could’ve been changed by upgrading to RC3… Any ideas? Thanks.
Offline
Re: [archived] tcm_rating: TXP Rating System
> chrisrhee wrote:
> Since I upgraded to RC3, all my ratings output numbers are 0. Not really sure what the problem is — it was working fine with RC1, I don’t know what could’ve been changed by upgrading to RC3… Any ideas? Thanks.
Replying to my own post… I figured out what was causing it. It’s a line in txplib_db.php in the getRows function.
From RC3:
while ($a = mysql_fetch_assoc($r)) $out[] = $a;
From RC1:
while ($a = mysql_fetch_array($r)) $out[] = $a;
So will this cause any errors if I change the line back to the way it was on RC1?
Offline
Re: [archived] tcm_rating: TXP Rating System
Hi is this plugin still supported? I’m finding the instructions a little confusing:
Installation
1. Upload rating_sql.php and rating.php to your Textpattern directory. 2. Go to rating_sql.php 3. Delete rating_sql.php 4. Install tcm_ratinginput and tcm_ratingoutputOk so I upload ratin_sql.php and rating.php tp TXP and then I delete rating_sql.php? Do I delete it straight away? What does uploading it do? Then install tcm_ratingiput and then output.
I’m confused. Addtionally I would like the output to contain smaller stars, as it’s supposed to fit inside a block which isn’t too wide. Is it also possible to have two ratings? An author rating and a reader rating?
Cheers
Offline
Re: [archived] tcm_rating: TXP Rating System
I just installed everything. Easy as pie. I am now looking for what has changed. There are no screen shots showing this. Anyone can post screen for us new people that would be great.
Offline
Re: [archived] tcm_rating: TXP Rating System
hmm moloko can you help and idiot figure this out? You followed the instructions to the letter right? I still don’t get it – you upload everything and before installing you delete one file…?
Offline