1 of 2
1
embed rating tag vs. non-embed - chasing my tail
Posted: 25 July 2007 08:13 AM   [ Ignore ]
Newbie
Rank
Total Posts:  18
Joined  2006-10-16

I’m trying to display the rating results where each entry has two rating categories - “Industry Relevance” and “Academic Relevance”.

When someone has rated either of these I want to show the rating.
When nobody has rated either of these, I want to display “no rating yet”.

My problem is that

{if no_results}No ratings yet{/if}

displays it’s message only when it’s embedded and the ratings results only display when they’re not embedded.

Here’s the code I’m using:

{exp:weblog:entries weblog="ig_articles" limit="1"}

<p>{igauthor} ({igyearauthored}). <u>{title}</u>. {igsource}.<br />

{embed="includes/ratings"}
<br /><br />
<
strong>Industry Relevance Rating:</strong><br />

{exp:rating:stats entry_id="{entry_id}" theme="default" form_name = "industryrelevance"}
(5 stars meaning very relevant - 1 not relevant)<br />
{stars_overall_avg}Based on {overall_count} review{if overall_count != "1"}s{/if}
{if no_results}No ratings yet
.{/if}
{
/exp:rating:stats}

<br /><br />

<
strong>Academic Relevance Rating:</strong><br />

{exp:rating:stats entry_id="{entry_id}" theme="default" form_name = "academicrelevance"}
(5 stars meaning very relevent - 1 not relevant)<br />
{stars_overall_avg}Based on {overall_count} review{if overall_count != "1"}s{/if}
{if no_results}No ratings yet
.{/if}
{
/exp:rating:stats}


<br /><br />
Comments: (how many) Implications: {if igimplications != ""}Yes{if:else}No{/if} Highlights: {if ighighlights != ""}Yes{if:else}No{/if}<br />

<
p><a href="{title_permalink=article}">[More...]</a></p>
<
hr />
{/exp:weblog:entries}

The URL below will take you to a page that displays the first Industry/Academic results as non-embedded, the second Industry/Academic results embedded:
http://www.investigaming.com/index.php/home/test/

Profile
 
 
Posted: 25 July 2007 12:38 PM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  701
Joined  2004-03-30

Have you tried running a conditional on the two rating categories like this?

{if industry == 0 && academic == 0}

 Signature 

Mitchell Kimbrough

Profile
 
 
Posted: 26 July 2007 06:15 AM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  18
Joined  2006-10-16

Yes, I have and it still displays whatever is in between the {if}{/if} even when a result has been entered.

Profile
 
 
Posted: 26 July 2007 08:41 AM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  701
Joined  2004-03-30

I think the modue may not be as smart as you need it to be.

 Signature 

Mitchell Kimbrough

Profile
 
 
Posted: 26 July 2007 09:49 AM   [ Ignore ]   [ # 4 ]
Newbie
Rank
Total Posts:  18
Joined  2006-10-16

That response makes me feel kind of put off.

You’ve built a really smart module and I know what I’m doing isn’t that complex, I just need a little help doing it.

Here, perhaps I was misunderstood - I’ll isolate what I’m trying to do:

{exp:rating:stats entry_id="{entry_id}" theme="default" form_name = "industryrelevance"}
{stars_overall_avg}Based on {overall_count} review{if overall_count
!= "1"}s{/if}
{if no_results}No ratings yet
.{/if}
{
/exp:rating:stats}

I want to display the rating if there is one, and “No ratings yet” if there isn’t a rating yet.

I need to do this twice on one page for two different types of rating for each article.

This isn’t working for me though and I can’t figure out why.

Profile
 
 
Posted: 26 July 2007 10:15 AM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  701
Joined  2004-03-30

Fifteen,

I’m sorry if the response was rude. It’s actually true though. The module isn’t quite smart enough to allow that granular a level of conditional.

The module only allows you to evaluate if any ratings have been submitted at all for an entry, not if a specific field has ever been submitted for a given entry. I’m sorry.

mk

 Signature 

Mitchell Kimbrough

Profile
 
 
Posted: 26 July 2007 01:29 PM   [ Ignore ]   [ # 6 ]
Newbie
Rank
Total Posts:  18
Joined  2006-10-16

It’s alright, it just seemed so final!

With all this said though,I still have this nagging feeling like I haven’t properly communicated my issue.

I just find it wierd that even when using this simple piece of code (below), I have no way of saying, “no entries yet”.

{exp:rating:stats entry_id="{entry_id}" theme="default" form_name = "industryrelevance"}
{stars_overall_avg}Based on {overall_count} review{if overall_count
!= "1"}s{/if}
{
/exp:rating:stats}

If no one has rated the entry using this code, then nothing shows up? That doesn’t seem right to me. Wouldn’t you want to show “no ratings”?

Sorry to be a pain, but i want to make totally sure that this is the case.

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

Why would a conditional based on {overall_count} fail? I don’t know, something like:

{exp:rating:stats entry_id="{entry_id}" theme="default" form_name = "industryrelevance"}
{if overall_count
> 0}
{stars_overall_avg}Based on {overall_count} review{if overall_count
!= "1"}s{/if}
{
/if}
{
/exp:rating:stats}

if that does fail (I haven’t tested it personally) we’ll pull the data out of the db with a manual SQL query and use some standard EE conditionals.

 Signature 

Ingmar Greil

Profile
 
 
Posted: 30 July 2007 06:14 AM   [ Ignore ]   [ # 8 ]
Newbie
Rank
Total Posts:  18
Joined  2006-10-16

I don’t think my question is getting through but thanks for hanging in here - Overall_count is not my problem.

If no rating has been entered, using this code displays nothing. It needs to say “not ratings yet” - how do I change that?

{exp:rating:stats entry_id="{entry_id}" theme="default" form_name = "industryrelevance"}
{stars_overall_avg}Based on {overall_count} review{if overall_count
!= "1"}s{/if}
{
/exp:rating:stats}

If you look at http://www.investigaming.com/index.php/home/test/ right now, I’ve rated Academic relevance - it shows just fine.
I haven’t rated Industry Relevance - nothing shows, its a blank space - how can I fix that?

Profile
 
 
Posted: 01 August 2007 08:28 PM   [ Ignore ]   [ # 9 ]
Newbie
Rank
Total Posts:  18
Joined  2006-10-16

Sorry to be a bother, but I guess this is my final answer? I still find it hard to believe there’s no way to tell users no ratings have been made yet. Thanks for all the help.

Profile
 
 
Posted: 04 August 2007 08:48 AM   [ Ignore ]   [ # 10 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  701
Joined  2004-03-30

It’s easy to display a no ratings yet message by using the exp:rating:entries tag. But what you want to do is test for each field right? If so, then I guess we don’t have a solution for you.

 Signature 

Mitchell Kimbrough

Profile
 
 
Posted: 04 August 2007 11:16 PM   [ Ignore ]   [ # 11 ]
Newbie
Rank
Total Posts:  8
Joined  2007-07-30

Hi Michael:

What might be the {} code you’d recommend to EE say with no ratings yet, or create a list of entries ?

Thank you, kindly.
--Alec

Profile
 
 
Posted: 04 August 2007 11:17 PM   [ Ignore ]   [ # 12 ]
Newbie
Rank
Total Posts:  8
Joined  2007-07-30

Duh!  I meant “Mitchell”, not “Michael” . . .  I guess I should insert foot into mouth . . .

Cheers.

Profile
 
 
Posted: 05 August 2007 11:56 AM   [ Ignore ]   [ # 13 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  701
Joined  2004-03-30

I’m thinking of this,

{exp:rating:entries blah blah blah}
{if no_results}Hey
. No Ratings yet. Be the first!{/if}
{
/exp:rating:entries}

And of very important note to all, If you include the above code inside a weblog:entries tag pair, the {if no_results} conditional will be interpreted and parsed out by the weblog:entries tag rather than the rating tag. So my team always uses an embed template to put the rating module code inside the weblog entries code. It’s a best practice all around.

And I answer to many many names. I’m not particular.

mk

 Signature 

Mitchell Kimbrough

Profile
 
 
Posted: 05 August 2007 12:28 PM   [ Ignore ]   [ # 14 ]
Newbie
Rank
Total Posts:  8
Joined  2007-07-30

Thanks, Mitchell. Much appreciated!

Profile
 
 
Posted: 06 August 2007 06:26 AM   [ Ignore ]   [ # 15 ]
Newbie
Rank
Total Posts:  18
Joined  2006-10-16

Mitchell,
How do I display a no ratings yet message by using the exp:rating:entries tag?

Profile
 
 
   
1 of 2
1