Hi everyone,
On my website (www.dualmonitorbackgrounds.com) I want to have the albums ordered by rating instead of alphabetically, so I tried out the Highest Rated Custom Function from the zenphoto Trac site, but I get a MySQL error:
`MySQL Query ( SELECT images.albumid, images.filename AS filename, images.title AS title, images.total_value AS totalvalue, images.total_votes as votes, albums.folder AS folder FROM images AS images, albums AS albums WHERE images.albumid = albums.id AND images.show = 1 ORDER BY (images.total_value/images.total_votes) DESC LIMIT ) Failed. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1`
Can anyone see an error in the syntax? Is it working for anyone else? If so, did you have to modify something?
Thanks
Comments
Anyway, I digress. The highest rated custom function requires the Zenphoto Rating Hack to be configured and working, as well as the DB modifications added before you can use the Highest Rated Custom Function. This requires DB mods, so make sure you're comfortable with that before proceeding.
I didn't write either function or the hack, but I have implemented both on my zenphoto implementations (see http://www.thinkdreams.com/zenphoto or http://www.bushwoodworking.com/zenphoto - both using the same theme right now) and they seem to work just fine.
I'll be happy to help you configure it and get it working if you want. It's not horribly difficult, just time consuming and a bit tricky.
You can grab everything you need for the Image Rating Hack off the wiki at http://www.zenphoto.org/trac/wiki/ZenphotoHacks#ImageRatingHack, and let me know if you have trouble.
That's great your work has dual monitors, it's becoming a trend in businesses slowly (which is why I made dmb, anticipating a large future market). I've definitely noticed my productivity increase with two, especially when I make websites (I run www.redskiesdesign.com also) it's great to have DreamWeaver in one screen and the preview in Flock on the other screen.
Anyway, I've had the image rating hack running for a while, you can see it below each image. Help with the Highest Rated Custom Function would be great!
Eventually I would like there to be an option of sorting. I want to have a dropdown list of, say:
Highest Rated
Most Commented On
Recently Added
Etc.
From the top of my head I think that's how Caedes does it. I actually originally offered to buy the Caedes code (before I found zenphoto) but the guy who makes it wouldn't sell. I'm glad though, their system uses a few other languages, so I'm much happier using just PHP, MySQL, JavaScript and things like that.
I think when there are enough images that will become an essential feature; sorting alphabetically is already a problem and I would like users to be able to choose for themselves what is most important to them. For the moment I'm happy with just getting everything sorted by rating though.
Anyway I blabbed on a bit there. Wow, make that a lot.
Look forward to your reply
Anyway, try that. Change the prefix. If you aren't using the images table for your image rating DB fields, that is.
I get exactly the same error as SubJunk. Did you already figure out a solution? Thanks!
An other thing came up though. The thumbs of the highest rated images are too large. Can I somehow change that with css?