Simple listing of all ratings showing stars and with paginiation
Posted: 28 April 2008 10:53 AM   [ Ignore ]
Jr. Member
RankRank
Total Posts:  35
Joined  2008-04-04

This code works ...

{exp:rating:rankings}

<div>{exp:rating:stats entry_id="{entry_id}" theme="default" precision="1" thousands="," fractions="."}{avg_rating}{/exp:rating:stats} {title}</div>

{/exp:rating:rankings}

... but isn’t quite what I am looking for.

Using this code, I have tried (by manipulating existing tags et al, unsuccessfully) to:

1. Have a simple listing (by average rating, starting with the highest rated first, then sorted by date)
2. Have the list stop at 5 and then paginate for the rest
3. Include the following tags ... {rating_name} / {rating_date format="%d/%m/%y"} / {rating_date format=’%h:%i%a’} ... on this page
4. Have, instead of the rating number (e.g. 5.0), show the number of stars by way of an image (just like the single entry page) - {stars}{rating}{/stars} ???

My questions are:

1. Pagination will work in the way I want it to?
2. Will the tags shown in 3. above work the way I would like to?
3. Can stars instead of a number be shown?

Thanks.

KCesp

Profile
 
 
Posted: 29 April 2008 07:38 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1901
Joined  2006-10-18

KCesp,

Try this code: smile

{exp:rating:rankings limit="5" paginate="bottom"

<div>{exp:rating:stats entry_id="{entry_id}" theme="default" precision="1" thousands="," fractions="."}{stars_overall_avg}{/exp:rating:stats} {title}<br />
{exp:rating:entries entry_id="{entry_id}" limit="1"}{rating_name} {rating_date format="%d/%m/%y"{rating_date format="%h:%i%a"}<br />{/exp:rating:entries}</div

{paginate}
<div class="paginate">
<
span class="pagecount">Page {current_page} of {total_pages} pages</span>  {pagination_links}
</div>
{/paginate}

{
/exp:rating:rankings}

I believe it solves all your issues smile

 Signature 
Profile
 
 
Posted: 04 May 2008 12:40 PM   [ Ignore ]   [ # 2 ]
Jr. Member
RankRank
Total Posts:  35
Joined  2008-04-04

Hi Pie Man.

Everything worked (thank you!) ... except for the pagination (which also failed in the code you provided, for some reason) ...

Here’s the code I am using right now:

<table width="100%" border="0" cellspacing="0" cellpadding="0">
{exp:rating:rankings weblog="weblogname" orderby_ratings="date" dynamic="off" limit="5" paginate="bottom"}
{exp
:rating:stats entry_id="{entry_id}" theme="default" precision="1" thousands="," fractions="."}
{exp
:rating:entries entry_id="{entry_id}" limit="1"}
<tr>
<
td width="99%" valign="top"><div class="hp_entries_items" onmouseover="this.style.backgroundColor='#F5F5F5'; "onmouseout="this.style.backgroundColor='#FFFFFF'"><img src="http://www.domainname.com/weblogname/kc_img/arrowS_orange.gif" width="3" height="7" /> <a href="{title_permalink=weblog_templates/comments}">{title}</a></div>
<
div class="summary_listall">{stars_overall_avg}</div>
<
div class="summary_listall">{review}</div>
<
div class="rating_by">Posted by <span class="orange">{rating_name}</spanon {rating_date format="%d/%m/%y"} at {rating_date format='%h:%i%a'} GMT+1<br />
<
br /></div>
</
td>
<
td width="1%" valign="top"><div align="right" class="hp_entries_list_date">{rating_date format='%d/%m/%y'}</div></td>
</
tr>
<
tr>
<
td valign="top">{paginate}
<div align="left" class="pagecount_L_coms"><div class="paginate_read_more_coms">Page {current_page} of {total_pages} pages</div>
<
div align="right" class="pagecount_R_coms">{pagination_links}</div></div>
{/paginate}{/exp:rating:entries}{/exp:rating:stats}{/exp:rating:rankings}</td>
<
td valign="top">&nbsp;</td>
</
tr>
</
table>

Maybe a case of the ‘wood for the trees’ ... but everything looks OK. Strange.

Anyhow, again, your insight and suggestions would be welcome.

Many thanks.

KCesp

Profile
 
 
Posted: 05 May 2008 07:58 AM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1901
Joined  2006-10-18

KCesp,

The pagination for the Rankings loop needs to be OUTSIDE of the exp:rating:stats and exp:rating:rankings loops, or it will otherwise collide wink

 Signature 
Profile
 
 
Posted: 07 May 2008 03:26 AM   [ Ignore ]   [ # 4 ]
Jr. Member
RankRank
Total Posts:  35
Joined  2008-04-04

Hi Pie Man.

To be honest, this is driving me round the bend ... Having tried what seems like every combination I can think of, I still can’t get the page to rank by rating with pagination.

My ‘current’ code ranks everything 5 star to 1 star but without pagination ...

<table width="100%" border="0" cellspacing="0" cellpadding="0">
{exp:rating:rankings weblog="weblogname" limit="5" dynamic="off" paginate="bottom"}
{exp
:rating:entries entry_id="{entry_id}" limit="1"}
<tr>
<
td width="99%" valign="top"><div class="hp_entries_items" onmouseover="this.style.backgroundColor='#F5F5F5'; "onmouseout="this.style.backgroundColor='#FFFFFF'"><img src="http://www.domainname.com/weblogname/kc_img/arrowS_orange.gif" width="3" height="7" /> <a href="{title_permalink=templates/comments}">{title}</a></div>
<
div class="summary_listall">{exp:rating:stats entry_id="{entry_id}" theme="default" precision="1" thousands="," fractions="."}{stars_overall_avg}{/exp:rating:stats}</div>
<
div class="summary_listall">{review}</div>
<
div class="rating_by">Posted by <span class="orange">{rating_name}</spanon {rating_date format="%d/%m/%y"} at {rating_date format='%h:%i%a'} GMT+1<br />
<
br /></div>
</
td>
<
td width="1%" valign="top"><div align="right" class="hp_entries_list_date">{rating_date format='%d/%m/%y'}</div></td>
</
tr>
<
tr>
<
td valign="top">{paginate}
<div align="left" class="pagecount_L_coms"><div class="paginate_read_more_coms">Page {current_page} of {total_pages} pages</div>
<
div align="right" class="pagecount_R_coms">{pagination_links}</div></div>
{/paginate}{/exp:rating:entries}{/exp:rating:rankings}</td>
<
td valign="top">&nbsp;</td>
</
tr>
</
table>

The code you suggested earlier ranks but does not paginate ... and the pagination is actually *within* the ‘exp:rating:rankings’ tags ...

{exp:rating:rankings limit="5" paginate="bottom"}

<div>{exp:rating:stats entry_id="{entry_id}" theme="default" precision="1" thousands="," fractions="."}{stars_overall_avg}{/exp:rating:stats} {title}<br />
{exp:rating:entries entry_id="{entry_id}" limit="1"}{rating_name} {rating_date format="%d/%m/%y"{rating_date format="%h:%i%a"}<br />{/exp:rating:entries}</div>

{paginate}
<div class="paginate">
<
span class="pagecount">Page {current_page} of {total_pages} pages</span>  {pagination_links}
</div>
{/paginate}

{
/exp:rating:rankings}

... which kinda contradicts your last note re. tag placement (which I have been trying to implement and with zero success).

What am I missing here?

Thanks in advance.

KCesp

Profile
 
 
Posted: 07 May 2008 07:26 AM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1901
Joined  2006-10-18

Maybe I’m misunderstanding what you’re after. smile

What is it you want Paginated?

The Rankings List?
The Entries list per Ranking?

 Signature 
Profile
 
 
Posted: 07 May 2008 07:44 AM   [ Ignore ]   [ # 6 ]
Jr. Member
RankRank
Total Posts:  35
Joined  2008-04-04

Hi Pie Man.

I already have a page which lists, by date, with pagination, all of the weblog entries which have received a rating. That works perfectly.

This discussion is about me wanting to have another page which lists, by the number number of stars awarded (starting with the 5’s, then the 4s, then the 3s etc. etc.), with pagination, all of the weblog entries which have received a rating.

The problem I am having is that the page is not paginating, in spite of your advice and my own combinations of tag placement.

KCesp

Profile
 
 
Posted: 08 May 2008 06:49 AM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1901
Joined  2006-10-18
KCesp - 07 May 2008 07:44 AM

The problem I am having is that the page is not paginating, in spite of your advice and my own combinations of tag placement.

I apologize… I thought you were after paginating the Rankings loop.

I’ve thought of a several ways you might be after doing this, and none of them are currently possible.

Filtering by rating is not possible.
If you want to have all Groups of ratings on the same page, with Pagination for each, it’s not possible.... maybe with Ajax though.

 Signature 
Profile
 
 
Posted: 08 May 2008 08:51 AM   [ Ignore ]   [ # 8 ]
Jr. Member
RankRank
Total Posts:  35
Joined  2008-04-04

OK. No problem.

Can I have a page, with pagination, which just shows the 5 star rated items?

Or have misunderstood? That would suit for what I now have in mind.

Thanks in advance.

KCesp

Profile
 
 
Posted: 08 May 2008 09:04 AM   [ Ignore ]   [ # 9 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1901
Joined  2006-10-18

The trouble is that there’s no way to filter out entries by rating.... with a parameter anyways.

You could perhaps use a conditional though…
Except the downside to that is that you would never get a “precise” list, including pagination

For example, if you want to display 5 entries with ratings of “4”, and paginate rest, you would do so by setting the parameters as such smile
Say you have 15 entries… of that three of them are rated as “4”. If you had a conditional that went something like this: {if rating_average == “4"} stuff {/if}
all it would do is not show the rest of the entries not rated “4”. Meanwhile, your Parameters don’t take this into account, so they would want to display all 15 entries. What would happen is, and of course depending on how you order them, you might get results like this:

Page 1
[blank]
Entry A
[blank]
[blank]
[blank]

Page 2
[blank]
[blank]
Entry B
Entry C
[blank]

Page 3
[blank]
[blank]
[blank]
[blank]
[blank]

Of course, to your visitors, it would appear like this:

Page 1
Entry A

Page 2
Entry B
Entry C

Page 3

I will submit a feature request for a rating filtering parameter smile

 Signature 
Profile
 
 
Posted: 08 May 2008 10:07 AM   [ Ignore ]   [ # 10 ]
Jr. Member
RankRank
Total Posts:  35
Joined  2008-04-04

OK. Thanks for that and all of your previous input - I appreciate it.

I’ll give what you said some thought ... I’ll be looking out for the ‘rating filtering parameter’ in the meantime though! I can’t be the only one who would like to see that in action on their site.

KCesp

Profile
 
 
Posted: 08 May 2008 10:31 AM   [ Ignore ]   [ # 11 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1901
Joined  2006-10-18

I agree,
I definately see a lot of value to it smile

...that’s why I’ve snuck it into the high priority “bug fixes” update for the next release of Rating cheese wink

 Signature 
Profile
 
 
Posted: 16 June 2008 05:32 PM   [ Ignore ]   [ # 12 ]
Jr. Member
RankRank
Total Posts:  32
Joined  2007-03-17
Pie Man - 29 April 2008 07:38 AM

KCesp,

Try this code: smile


{exp:rating:rankings limit="5" paginate="bottom"

<div>{exp:rating:stats entry_id="{entry_id}" theme="default" precision="1" thousands="," fractions="."}{stars_overall_avg}{/exp:rating:stats} {title}<br />
{exp:rating:entries entry_id="{entry_id}" limit="1"}{rating_name} {rating_date format="%d/%m/%y"{rating_date format="%h:%i%a"}<br />{/exp:rating:entries}</div

{paginate}
<div class="paginate">
<
span class="pagecount">Page {current_page} of {total_pages} pages</span>  {pagination_links}
</div>
{/paginate}

{
/exp:rating:rankings}


I believe it solves all your issues smile

Hey Pie Man,

I have tried this code in my template but I am getting some weird results.

<ul class="pthumbnnew">
 
{exp:rating:rankings
  limit
="2"
  
paginate="bottom"
 
}
  
<li>
   <
a href='{permalink="gallery/photo"}{url_title}'>{exp:imgsizer:size src="{photo_primary_url}" width="90" height="90" alt="{title}"}</a>
  </
li>
 
{paginate}
 
</ul>
 <
class="pageno">Page {current_page} of {total_pages} 
  {if previous_page}
<span class='next'><a href="{auto_path}">&laquoPrev</a></span>{/if}
  {if next_page}
<span class='next'><a href="{auto_path}">Next &raquo;</a></span>{/if}
 
</p>
{/paginate}
{
/exp:rating:rankings}

The code above only renders one result and 1 page. I know there is more than one entry being ranked.

When I change the limit to 3 only two entries are displayed but still one page. Rather strange.

I have no weblog:entries tags on the page or any other things that might freak out the loop. Any ideas?

 Signature 

leevigraham.com
LG TinyMCE 1.2.1
LG Better Meta 1.4
LG Social Bookmarks 1.4.1
LG Polls - Now Available

Profile
 
 
Posted: 16 June 2008 05:49 PM   [ Ignore ]   [ # 13 ]
Jr. Member
RankRank
Total Posts:  32
Joined  2007-03-17

Ok I re-installed the module and cleared all my cache / cookies and the limit is working properly now. However the pagination is still only showing one page. :(

 Signature 

leevigraham.com
LG TinyMCE 1.2.1
LG Better Meta 1.4
LG Social Bookmarks 1.4.1
LG Polls - Now Available

Profile
 
 
Posted: 17 June 2008 07:25 AM   [ Ignore ]   [ # 14 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1901
Joined  2006-10-18

Leevi,

There was a bug with this. It has been corrected for Rating 2.2.0 (which should be released very shortly).
I have it loaded on my test server, and was able to successfully get your code to work smile

We just have a little bit of fine tuning left to do, including some intense optimization which should get the module running 10 times faster that normal. wink

 Signature 
Profile