Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2005-01-10 20:51:29

chrisrhee
Member
Registered: 2004-07-01
Posts: 33
Website

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

#32 2005-01-10 23:51:55

paularms
Member
From: University of Minnesota
Registered: 2004-10-21
Posts: 155
Website

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

#33 2005-01-14 15:42:46

paularms
Member
From: University of Minnesota
Registered: 2004-10-21
Posts: 155
Website

Re: [archived] tcm_rating: TXP Rating System

anybody?

Offline

#34 2005-01-14 20:49:01

tmacwrig
Archived Plugin Author
Registered: 2004-03-06
Posts: 204
Website

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

#35 2005-01-14 23:09:22

paularms
Member
From: University of Minnesota
Registered: 2004-10-21
Posts: 155
Website

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

#36 2005-01-15 03:24:04

paularms
Member
From: University of Minnesota
Registered: 2004-10-21
Posts: 155
Website

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

#38 2005-01-15 03:39:56

tmacwrig
Archived Plugin Author
Registered: 2004-03-06
Posts: 204
Website

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

#39 2005-01-15 04:20:55

paularms
Member
From: University of Minnesota
Registered: 2004-10-21
Posts: 155
Website

Re: [archived] tcm_rating: TXP Rating System

programming is my achille’s heel. all i really can do is XHTML + CSS

Offline

#40 2005-01-18 02:43:42

chrisrhee
Member
Registered: 2004-07-01
Posts: 33
Website

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

#41 2005-04-15 05:44:26

chrisrhee
Member
Registered: 2004-07-01
Posts: 33
Website

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

#42 2005-04-15 06:40:43

chrisrhee
Member
Registered: 2004-07-01
Posts: 33
Website

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

#43 2005-05-25 12:34:14

sekhu
Member
Registered: 2005-05-12
Posts: 428
Website

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_ratingoutput

Ok 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

#44 2005-05-25 17:48:52

moloko
Member
From: USA
Registered: 2005-05-25
Posts: 35
Website

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

#45 2005-05-25 17:52:09

sekhu
Member
Registered: 2005-05-12
Posts: 428
Website

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

Board footer

Powered by FluxBB