Hi there,
Ive got a question: What is the File called which exports the Best Rated Pictures.
For example here is my page http://www.oozaru.ch/Kunden/piwigo/inde … best_rated
i now want to adjust the title. For example i want to add the text Best Rated under the word Gallery. and i would like to give every image a number. The first one gets numer #1 second one gets #2 and so on and so on. Is there a way to do that nicely?
looking forward to you answer :D best regards
dom
ps: i really like piwigo! Its the best Gallery Script ever! :D
is it possible to also add this? i mean i know where to get the number of voters and to get the number for the stars but i dont know where to get the "#1" the count of the image. Im pretty sure theres a string which will give me these numbers i just cant figure it out. i hope you can help me with those 2 issues.
thank you very much
best regards
Hi Dominik,
1) install/activate [extension by Piwigo Team] LocalFiles Editor from screen [Administration > Plugins > Manage]
2) go to [Administration > Plugins > LocalFiles Editor > Personal Plugin] and paste the following code:
<?php /* Plugin Name: Personal Plugin Version: 1.0 Description: Personal Plugin Plugin URI: http://piwigo.org Author: Author URI: */ add_event_handler('loc_end_index_thumbnails', 'best_rated_caption', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); function best_rated_caption($tpl_thumbnails_var, $pictures) { global $page; if (count($pictures) == 0 or 'best_rated' != $page['section']) { return $tpl_thumbnails_var; } $image_ids = array(); foreach ($pictures as $picture) { array_push($image_ids, $picture['id']); } $query = ' SELECT element_id, COUNT(*) AS counter FROM '.RATE_TABLE.' WHERE element_id IN ('.implode(',', $image_ids).') GROUP BY element_id ;'; $result = pwg_query($query); $nb_votes_for = array(); while ($row = pwg_db_fetch_assoc($result)) { $nb_votes_for[$row['element_id']] = $row['counter']; } $num = 1; foreach ($tpl_thumbnails_var as $idx => &$tpl_var) { $id = $tpl_var['ID']; $tpl_var['NAME'] = '<div style="font-size:25px;text-align:left;float:left;">#'.$num++.'</div>'; $tpl_var['NAME'].= '<div style="float:right;text-align:right">'; $tpl_var['NAME'].= $pictures[$idx]['average_rate'].' stars'; $tpl_var['NAME'].= '<br>'; $tpl_var['NAME'].= $nb_votes_for[$id].' votes'; $tpl_var['NAME'].= '</div>'; } return $tpl_thumbnails_var; } ?>
3) go to screen [Administration > Plugins > Manage] and activate the Personal Plugin
Offline
In case you wonder how it looks, here is an example on my development environment.
Offline
Thank you for you Answer, but when i followed you instruction the site got empty
http://web293.login-113.hoststar.ch/piwigo/index.php
i got the instructions from here
[Forum, post 116586 by plg in topic 16551] Best Rated
what should i do now? :O im kinda stuck and dont even know how to get back :O
:-/
Connect to your website with your FTP client and remove the plugins/PersonalPlugin directory
Offline
Still nothing :O could not even find the folder
http://web293.login-113.hoststar.ch/piwigo/index.php
ohhhh nooooooooooo i eddited the whole piwigo templates and now its all gone :O ahhhh i just dont know where to begin to fix this :(
It looks like it killed my whole piwigo gallery, no idea what id did but even when i replace all the files its still nothing i think i have to reinstall it :(
Did it write into another file than the main.inc.php? because all the piwigo files are empty
http://web293.login-113.hoststar.ch/piw … cation.php
http://web293.login-113.hoststar.ch/piwigo/admin.php
very strange... hope you can help me
Just right now, it works quite well. The same way it was working before you tried the Personal Plugin, doesn't it?
Offline
Yes i managed id to get it to the old standards hmmm i think i will stay with them but it would have been nice the way you showed it to me.
I don't understand why my Personal Plugin doesn't work and breaks your gallery.
Which customization did you make on your Piwigo installation? (be precise please)
Offline
The problem is that i didnt do anything special i just edited the template. I created a new one out of the simple grey one, which will fit my homepage. i didnt change a single thing on the code or the functions just created a different template. thats how precise i can go...
im very thankful for your help but its ok i just live without this script. i must say the support here is really nice, this is a wonderful script and im really looking forward to use it daily :D
:-/ my Personal Plugin works on Simple Grey on my Piwigo local copy.
Offline
Thats very strange... Im adjusting everything maybe it will work ill keep you uptodate if ill find the problem
thank you very much for your time and your help