Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-03-03 12:02:14

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

jmd_rate: A CSS star rater

Download 0.4 | Demo

<txp:jmd_rate/> is a comprehensive CSS star rater that features customizable output, article_custom for ratings, and a rating-CSS generator.

Requirements

Example syntax

<txp:hide>Either in an article or article form:</txp:hide>
<txp:jmd_rate>
	<txp:if_jmd_rate_votes>
		<p>
			Currently rated <txp:jmd_rate_rating/>/<txp:jmd_rate_max/> after <txp:jmd_rate_votes singular="vote" plural="votes"/>.
		</p>
	<txp:else/>
		<p>
			This article hasn’t been rated.
		</p>
	</txp:if_jmd_rate_votes>

	<txp:jmd_rate_display/>

	<txp:if_jmd_rate_voted>
		<p>
			Thanks for voting.
		</p>
	</txp:if_jmd_rate_voted>
</txp:jmd_rate>

For <txp:jmd_rate_article/>:

<txp:hide>Page or form template:</txp:hide>
<ol>
	<txp:jmd_rate_article form="highest_rated" max_value="10" min_value="8" section="articles" />
</ol>

<txp:hide>Article form: highest_rated</txp:hide>
<li>
	<txp:permlink>
		<txp:title/>
	</txp:permlink>:
	<txp:jmd_rate>
		<txp:jmd_rate_rating/>/<txp:jmd_rate_max/>
	</txp:jmd_rate>
</li>

Credits

Many thanks to the following people:

Edit: Wrong version number (0.3 instead of 0.4).

Last edited by jm (2009-06-12 06:23:44)

Offline

#2 2008-03-03 12:04:31

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: jmd_rate: A CSS star rater

Nice one jm :-) Does it make coffee when you hit gold mine? :P

Offline

#3 2008-03-05 09:23:14

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 684

Re: jmd_rate: A CSS star rater

It would be nice to add the “half-star” option, in case, for example, I’d like to rate a film with 2.5 stars out of 5 (filling the relative custom field).

Offline

#4 2008-03-05 09:30:31

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,422
Website GitHub

Re: jmd_rate: A CSS star rater

candyman wrote:

It would be nice to add the “half-star” option, in case, for example, I’d like to rate a film with 2.5 stars out of 5

Or just make it out of 10 and stick to integers :-P


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#5 2008-03-05 11:13:17

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: jmd_rate: A CSS star rater

Hehe nice Stef. candyman, integers make sense for the star input, but the plugin calculates the overall rating, which can draw half stars.

I’ve got a newer, more customizable version almost complete. It should be done later on today. It’s up.

Last edited by jm (2008-03-06 13:33:29)

Offline

#6 2008-03-06 10:01:03

Niconemo
Member
From: Rhône-Alpes, France
Registered: 2005-04-18
Posts: 557

Re: jmd_rate: A CSS star rater

:-(

Looks nice… but :

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /mysitepath/textpattern/lib/txplib_misc.php(574) : eval()’d code on line 166
Erreur lors du chargement du plugin ci-dessus jmd_rate

Between step 2 an 3 of the “Getting started”…


Nico

Offline

#7 2008-03-06 13:33:42

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: jmd_rate: A CSS star rater

Nico, try the new version.

Offline

#8 2008-03-06 15:04:54

Niconemo
Member
From: Rhône-Alpes, France
Registered: 2005-04-18
Posts: 557

Re: jmd_rate: A CSS star rater

Thanks !

edit :

;-) There is a difference :

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /mysitepath/textpattern/lib/txplib_misc.php(574) : eval()’d code on line 303
Erreur lors du chargement du plugin ci-dessusjmd_rate

Last edited by Niconemo (2008-03-06 15:07:04)


Nico

Offline

#9 2008-03-06 15:29:29

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: jmd_rate: A CSS star rater

Niconemo, are you sure that you are using it on PHP5? The version 0.1 beta worked for me, when we were testing it out.

Offline

#10 2008-03-06 19:51:43

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 684

Re: jmd_rate: A CSS star rater

Ops, I didn’t read carefully… I thought it was a plugin to set the star rating in review by the author of the article and not a system to allow the reader to vote the article itself…

Offline

#11 2008-03-08 17:28:07

Niconemo
Member
From: Rhône-Alpes, France
Registered: 2005-04-18
Posts: 557

Re: jmd_rate: A CSS star rater

Gocom wrote:

Niconemo, are you sure that you are using it on PHP5? The version 0.1 beta worked for me, when we were testing it out.

Oh my… I’m completely sorry ! You’re right. My default setting for all site is PHP 5.0.2 but I’m currently testing on a site that was set to PHP 4 (don’t remember why… probably because of an old plugin…).

Everything seems to work with the default 4 star rater (I’ve got some troubles when testing with 5 stars but it’s probably my fault again, I’ll try again later)

Thanks for all !


Nico

Offline

#12 2008-03-20 05:24:55

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: jmd_rate: A CSS star rater

0.3 is up! This fixes the irritating fcgi redirect bug, so jmd_rate should work on all servers. Next stop: Ajax!

Offline

#13 2008-03-28 12:02:38

lozmatic
Member
From: Melbourne, Australia
Registered: 2006-08-27
Posts: 259
Website

Re: jmd_rate: A CSS star rater

Works wonderfully in FireFox but not in IE6, but I think it must be something to do with my setup here at work.

Can I suggest a variation on the theme? A very useful one, I think.

The idea is to have the voting option as part of a comment form so that with each rating a user needs to add a comment too. Pretty much like you see on Amazon.

Offline

#14 2008-03-28 19:23:58

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: jmd_rate: A CSS star rater

Are you getting styling errors in IE6? I don’t support IE6, but I imagine the fix for whatever error is height: 1% :P.

I haven’t played too much with adding events to the comment form, but I’ll give it a shot.

Offline

#15 2008-03-31 16:49:38

lozmatic
Member
From: Melbourne, Australia
Registered: 2006-08-27
Posts: 259
Website

Re: jmd_rate: A CSS star rater

jm, i’ve changed php to 5 and are having some problems.

Firstly, I’m not sure where the images should go. The links to the graphics you posted don’t work. I’ve got my own starts but I don’t know what to call them or where to place them.

Withotu stars I get a list of options more or less like this:

* Currently rated * 1/4 * 2/4 * 3/4 * 4/4

The numbers are linked correctly (eg: http://www.domain.com/page?rating=1) but clikcing them will not register a vote – status doesn’t change from “his article hasn’t been rated”.

I haeb a feeling there is something extrenmely simple I am not doing.

Offline

Board footer

Powered by FluxBB