form, form name, and entry_id
Posted: 14 July 2007 03:21 PM   [ Ignore ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  118
Joined  2005-09-13

Hey guys, I’m finding myself a bit confused (and hence my code is confused too) about the use of the form, form_name and entry_id parameters. In the module’s back end I see that ratings are categorized by, I believe, form_name, right? This is so one EE entry can have multiple ratings like with the hotel example (comfort, location, etc), but then there’s a form_id and form= parameter…

Okay, maybe I"m just talking aloud to vent/sort things out, but it’s tough to get my head around! LOL

Can you guys suggest a best practice on the use of the form_name field? For example, just each entry have it’s own form_name?

Profile
 
 
Posted: 14 July 2007 04:45 PM   [ Ignore ]   [ # 1 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  118
Joined  2005-09-13

Okay, here’s a tricky one for me. I’m trying to use

{exp:rating:entries limit="10" form_name="stylasticRatings"}

<div class="rating-indicator">
Last rating in the system...
{stars}{rating}{/stars}
<class="attributes">
<
a href="/user/edit/{rating_author_id}">{screen_name}</a><br />
Date{rating_date format="%m/%d/%y %H:%M"}
</p>
</
div>
{review}
{
/exp:rating:entries}

The form_name allows me to grab the last 10 ratings for all entries, but I only want the last 10 ratings for one specific entry (I’m returning this template from the rating form by AJAX). It doesn’t take entry_id as a param… so should I be using a different tag here?

Thanks!

Profile
 
 
Posted: 15 July 2007 08:24 AM   [ Ignore ]   [ # 2 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  336
Joined  2005-07-09
wondermonkey - 14 July 2007 03:21 PM

In the module’s back end I see that ratings are categorized by, I believe, form_name, right?

Yes, it’s sorted by form. You can actually have multiple forms, rating totally different things.

This is so one EE entry can have multiple ratings like with the hotel example (comfort, location, etc), but then there’s a form_id and form= parameter…

The form parameter determines which form to use. Non-existent ones will be generated on the fly. The form_id is a totally different thing; it assigns an id to your HTML <form> tag, like so:

<form id="my_private_form">

What for, I hear you ask? So you can style it via CSS, eg. You can safely ignore it for the time being.

Can you guys suggest a best practice on the use of the form_name field? For example, just each entry have it’s own form_name?

It’s really easy. You use one form for one set of fields that you want to rate by. “my_rating_form” should work fine.

 Signature 

Ingmar Greil

Profile
 
 
Posted: 15 July 2007 08:31 AM   [ Ignore ]   [ # 3 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  336
Joined  2005-07-09
wondermonkey - 14 July 2007 04:45 PM

The form_name allows me to grab the last 10 ratings for all entries, but I only want the last 10 ratings for one specific entry

I think you’ll have to use a custom SQL query for that one.

 Signature 

Ingmar Greil

Profile
 
 
Posted: 26 July 2007 03:11 PM   [ Ignore ]   [ # 4 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  118
Joined  2005-09-13

Why wouldn’t this tag be built to take an entry_id? Wouldn’t the normal use be to show the last reviews for one specific entry alongside the rating:stats stars (for eg.)?

Is there a different tag I should be using?

Profile
 
 
Posted: 26 July 2007 03:20 PM   [ Ignore ]   [ # 5 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  118
Joined  2005-09-13

Also note that for exp:rating:entries the variable {review} is used in the example but not mentioned in the text of the docs under variables.

I’m trying to run a conditional against it but apparently it doesn’t work.

Profile
 
 
Posted: 30 July 2007 12:43 AM   [ Ignore ]   [ # 6 ]
Sr. Member
Avatar
RankRankRankRank
Total Posts:  336
Joined  2005-07-09

I don’t know about “normal use”, but in most rating scenarios people are mostly interested in averages. To compare against review, try using something like

{if "{review}" == "..."}

On a side note, Mitch is currently working on a new version of Rating. This might be a good time for feature requests.

 Signature 

Ingmar Greil

Profile