Announcement

#1 2010-10-19 12:09:05

Dominik
Guest

[resolved] Best Rated

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

 

#2 2010-10-19 12:27:49

Dominik
Guest

Re: [resolved] Best Rated

http://www.oozaru.ch/Kunden/1.jpg

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

 

#3 2010-10-26 01:59:18

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: [resolved] Best Rated

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:

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

 

#4 2010-10-26 02:04:35

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: [resolved] Best Rated

In case you wonder how it looks, here is an example on my development environment.

Offline

 

#5 2010-10-26 10:34:25

Dominik
Guest

Re: [resolved] Best Rated

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

 

#6 2010-10-26 10:38:03

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: [resolved] Best Rated

:-/

Connect to your website with your FTP client and remove the plugins/PersonalPlugin directory

Offline

 

#7 2010-10-26 14:32:28

Dominik
Guest

Re: [resolved] Best Rated

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 :(

 

#8 2010-10-26 14:35:08

Dominik
Guest

Re: [resolved] Best Rated

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 :(

 

#9 2010-10-26 14:38:00

Dominik
Guest

Re: [resolved] Best Rated

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

 

#10 2010-10-26 14:49:50

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: [resolved] Best Rated

Just right now, it works quite well. The same way it was working before you tried the Personal Plugin, doesn't it?

Offline

 

#11 2010-10-26 15:31:45

Dominik
Guest

Re: [resolved] Best Rated

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.

 

#12 2010-10-26 16:15:31

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: [resolved] Best Rated

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

 

#13 2010-10-26 16:43:49

Dominik
Guest

Re: [resolved] Best Rated

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

 

#14 2010-10-26 16:47:40

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: [resolved] Best Rated

:-/ my Personal Plugin works on Simple Grey on my Piwigo local copy.

Offline

 

#15 2010-10-26 16:56:58

Dominik
Guest

Re: [resolved] Best Rated

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

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact