0

I got this problem: My entries are rated (star-rating, just submits a value between 1 and 5). Now I want to show on a single-entry-pages the top-rated entries of the category the actual entry is in. Example: We are on entry-page "Snoopy" which is filed in the category "dogs". I want a list like "Best rated entries in dogs: - Snoopy xxxxx - Other dogs xxx - My dog xx - My mother's dog xx

I tried for hours and hours, but with no success. Perhaps anybody could give me a hint what I am doing wrong?

I got a lot of code snippets that all don't work, here is one:

<ul class="">
{exp:rating:rank channel="{my_channel}" limit="3" category = "2" dynamic="no"} 
 {exp:rating:stats}             
  <li>
   {title} - {overall_avg}
  </li>
 {/exp:rating:stats}
{/exp:rating:rank} 

This one just shows me nothing. If I remove the exp-rating-stats-loop it only shows me 3 times the actual entry. I would appreciate any help very much - thanks!

EDIT: FURTHER EXAMPLES

Here are some examples: In an empty template this generates the correct output, 5 entries with their titles:

{exp:rating:rank category="24" limit="5"}
{title}
{/exp:rating:rank}

while in my standard-template there is no output. When I add the parameter dynamic="no" I get the entry of the page I am.

EDIT 2: EXP:CHANNEL:ENTRIES-LOOP

When I put it OUTSIDE the exp:channel:entries-loop, it works. My loop is

{exp:channel:entries channel="{snp_my_channel}" limit="1"
disable="member_data|trackbacks|pagination" track_views="two"
status="open" cache="no" refresh="2500"
require_entry="yes"}

But I need it inside the loop. Is there perhaps any parameter missing?

4
  • What version of Rating are you using? Also, why is there a {exp:rating:stats} tag pair inside {exp:rating:rank}? Have you tried just using {exp:rating:rank} and see if the {title} is displaying at least?
    – Solspace
    Apr 21 '14 at 5:34
  • I am using 3.2.3. Added some examples in my original post, perhaps you could have a look?
    – BNetz
    Apr 21 '14 at 6:34
  • So {exp:rating:rank} is within {exp:channel:entries}? Any reason for that? Since both tags share the same Channel Entries library and have many variables and tags in common, you will run into variable clashes. Use {exp:rating:rank} outside of {exp:channel:entries}, or use an embed for {exp:rating:rank}.
    – Solspace
    Apr 21 '14 at 9:26
  • Hey @Solspace, moving it to a template did the trick. Perhaps you should mention explicitly in the docs that exp:rating:rank has to be outside the exp:channel:entries-tag. Please write an answer with this so I can marked this as solved. Thanks for your fast and competent support!!!
    – BNetz
    Apr 22 '14 at 9:21
1

The issue was that {exp:rating:rank} was inside a {exp:channel:entries} tag pair.

Since both tags share the same Channel Entries library and have many variables and tags in common, you will run into variable clashes. In other words, EE will be confused about which variables to parse for which tag pair, etc. Use {exp:rating:rank} outside of {exp:channel:entries}, or use an embed for {exp:rating:rank}. In other words, use:

{exp:channel:entries /* your other parameters */}
  // Some entry data
  {embed="rating/rank"}
{/exp:channel:entries}

or even better:

{exp:channel:entries /* your other parameters */}
  // Some entry data
{/exp:channel:entries}

<h3>Top entries</h3>
{exp:rating:rank /* your other parameters */}
  // Some ranked entry data
{/exp:rating:rank}
-1

Perhaps it miss the entry id:

{exp:rating:stats entry_id="{entry_id}"}

Or could be a parsing problem: try to insert: parse="inward"

{exp:rating:rank channel="{my_channel}" limit="3" category = "2" dynamic="no" parse="inward"} 
3
  • Thanks for your suggestions, Stephane. I don't think the entry_id is needed, because I don't want to show the reviews for one entry, but just a list of rated entries. Use of the parse-parameter changed nothing.
    – BNetz
    Apr 20 '14 at 20:14
  • do you use Low Variables or Stash?? Perhaps could be a parsing order......
    – Stéphane
    Apr 21 '14 at 1:30
  • none of them ...
    – BNetz
    Apr 21 '14 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.