I've taken the show_highest_rated function and modified it so it will work in my case, so I'm posting it on here in case someone will find it useful.
For those who don't know, the function is for displaying image thumbnails in order of rating (instead of the default; alphabetically) on an album page.
You can see this code working at
http://www.dualmonitorbackgrounds.com/ on any of the category pages.
The changes are as follows:
It now gets the rating information from a table called "ratings", as I have set up a separate ratings table in hopes that it will be easier for future compatability.
I've made it so that it should be pasted into album.php, replacing the call to the printAlbumDesc function.
There's now no limit on the images displayed (it will display all the images in an album)
So here it is:
`function show_highest_rated() {
$images = query_full_array("SELECT images.albumid, images.filename AS filename, images.title AS imgtitle, ratings.total_value AS totalvalue, ratings.total_votes as votes, albums.folder AS folder, albums.title FROM images AS images JOIN albums AS albums JOIN ratings ON albums.id = images.albumid ON images.id = ratings.id WHERE albums.title = '".getAlbumTitle()."' ORDER BY (ratings.total_value/ratings.total_votes) DESC");
$size = '_'.zp_conf('thumb_size').'_cw'.zp_conf('thumb_crop_width').'_ch'.zp_conf('thumb_crop_height');
foreach ($images as $image) {
$filename = $image['filename'];
$album = $image['folder'];
$desc = $image['imgtitle'];
$totalvalue =
@number_format($image['totalvalue']/$image['votes'],2);
echo '
';
}
}
show_highest_rated();`
Might be annoying to you that I've included everything in the echos but that's easy enough to fix
There is also a reference to CSS, it's just:
`.latestimage2 {
float: left;
padding: 7px;
margin: 16px;
line-height: 0px;
background: url('img-bg.gif') top left no-repeat;
}`
That's for my theme, which is based on Sterile. Anyway I suggest you add the CSS even if you aren't using Sterile, because it will keep the images organized while you change it to fit your design.
I'm happy to help if anyone wants to know anything else.