Jamroom Logo Jamroom 5 Core
is now Open Source!
User Support Forum Archive (Read Only)
User Site Design, Integration and Customization:
Graphic Star Ratings
rekrapt



Joined: 02 Oct 2004
Posts: 308
Location: Gulfport, MS

Posted: 11/19/04 12:55 
Glad you liked them.

I did it soley due to my dislike of decimal places.

Very Happy

Tom
http://www.tparker.net

Back to top
ramz



Joined: 28 Feb 2005
Posts: 99
Location: Fairfax, VA

Posted: 03/09/05 14:20 
Just went and did the star rating thing from scratch and came up with a system that rounds to the nearest 1/2 star, with the lowest possible "active" rating being a "1".



As you can see, I designed everything to be specific for the jm_cobalt_2.2 theme since that's all I allow on my site, so the light blue matte would likely have to be modified for sites using something else (I can provide the .ai source file for my stars if anyone's interested). To get the rating math results to be stuffed into the database properly, I really only had to change two lines in the rating.php script (lines 499 & 503):
Code
$_rt['rating_average'] = round((($tot + $_post['rate_num']) / ($num + 1)) * 2,0) / 2;
}
else
{
$_rt['rating_average'] = round(((($_rt['rating_number'] * $_rt['rating_average']) + $_post['rate_num']) / ($_rt['rating_number'] + 1)) * 2,0) / 2;
(note the '* 2, 0) / 2' bit)

From there, it was a simple matter of making a small adjustment to the jamroom\themes\jm_cobalt_2.2\song_header.tpl file (line 10):

Code
<span style="padding-right: 1em">Current Rating: <img src="{THEME_URL}/images/{SONG_RATING_AVG}.gif" alt="{SONG_RATING_AVG} stars" style="vertical-align: middle; border=0"/><span style="font-size: 8pt; font-weight: bold; vertical-align: middle"> / {SONG_RATING_NUM} </span><a href="{SONG_RATING_FORM}&template=cobalt_rate_song.tpl" {POPUP_JAVALINK}><span style="font-size: 8pt; font-weight: bold; vertical-align: middle">&nbsp;[ rate ]</span></a></span>
plunk the stars files into jamroom\themes\jm_cobalt_2.2\images directory and you're off to the races. If you use different themes on your site, just create stars that work for those themes and plunk them into the correct directory (the tpl file handles the addition regardless of theme selected).

I made a number of other minor tpl modifications that allow the rating to be shown when Songs are listed in a matrix, etc. All fairly easy to do, so I won't go into details there... Still several things to work out, but you guys can start to see where I'm going with jamroom on my site:

http://www.ramzvents.com/public/index.php?option=com_wrapper&Itemid=83

Try sorting by Tracks by whatever to see the matrix ratings and then click on an artist to see the use of the stars there. Hope this is helpful to some people... Good luck!

Back to top
werkkrew



Joined: 20 Feb 2004
Posts: 126
Location: Phildadelphia, PA USA

Posted: 04/13/05 17:06 
I wrote a script to do this in my new template by hand before I even saw this

It used the output buffer just like bigguy suggested here since the varible is an include, rounds it to the nearest whole

The only difference really is my script has 2 images, an empty star and a full star, so it just uses logic to output all the images next to each other.

This feature is included in my theme which I submitted to the contest.


_________________
My Site:
www.werkkrew.com
Affordable Web Design and Site Hosting:
www.werktheweb.com

Back to top
Display posts from previous:   
User Support Forum Archive (Read Only)
User Site Design, Integration and Customization

< Previous12
 
Solutions
• Social Media Platform
• Social Networking Software
• Musician Website Manager
• Community Builder
Products
• Jamroom Core
• Jamroom Addons
• Jamroom Modules
• Jamroom Marketplace
Support
• Support Forum
• Documentation
• Support Center
• Contact Support
Community
• Community Forum
• Member Sites
• Developers
Company
• About Us
• Contact Us
• Privacy Policy
©2003 - 2010 Talldude Networks, LLC.