Meta albums - specifying a category? Meta albums - specifying a category?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Meta albums - specifying a category?

Started by Steve-R, November 11, 2007, 02:55:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Steve-R

I want to specify only one of the two categories from my gallery in the meta album "Top Rated" here is the function from functions.inc.php What would I need to change or add to achieve this? The catergory is cid1


                case 'toprated': // Top rated pictures

if (GALLERY_ADMIN_MODE){
                if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = $lang_meta_album_names['toprated'].' - '. $CURRENT_CAT_NAME;
                } else {
                        $album_name = $lang_meta_album_names['toprated'];
                }
                $query = "SELECT COUNT(*) from {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND votes >=

'{$CONFIG['min_votes_for_rating']}' $META_ALBUM_SET";
                $result = cpg_db_query($query);
                $nbEnr = mysql_fetch_array($result);
                $count = $nbEnr[0];
                mysql_free_result($result);

                //if($select_columns != '*') $select_columns .= ', pic_rating, votes, aid, owner_id, owner_name';
                $select_columns = '*'; //allows building any data into any thumbnail caption

                $query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND votes >=

'{$CONFIG['min_votes_for_rating']}' $META_ALBUM_SET ORDER BY (pic_rating * votes) DESC, votes DESC, pid DESC $limit";
                $result = cpg_db_query($query);
                $rowset = cpg_db_fetch_rowset($result);
                mysql_free_result($result);

                if ($set_caption) build_caption($rowset,array('pic_rating'));

                $rowset = CPGPluginAPI::filter('thumb_caption_toprated',$rowset);

                return $rowset;
                break;

}else{

if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = $lang_meta_album_names['toprated'].' - '. $CURRENT_CAT_NAME;
                } else {
                        $album_name = $lang_meta_album_names['toprated'];
                }
                $query = "SELECT COUNT(*) from {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND (aid < '2' OR aid > '2') AND

votes >= '{$CONFIG['min_votes_for_rating']}' $META_ALBUM_SET";
                $result = cpg_db_query($query);
                $nbEnr = mysql_fetch_array($result);
                $count = $nbEnr[0];
                mysql_free_result($result);

                //if($select_columns != '*') $select_columns .= ', pic_rating, votes, aid, owner_id, owner_name';
                $select_columns = '*'; //allows building any data into any thumbnail caption

                $query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND (aid < '2' OR aid > '2')

AND votes >= '{$CONFIG['min_votes_for_rating']}' $META_ALBUM_SET ORDER BY (pic_rating * votes) DESC, votes DESC, pid DESC $limit";
                $result = cpg_db_query($query);
                $rowset = cpg_db_fetch_rowset($result);
                mysql_free_result($result);

                if ($set_caption) build_caption($rowset,array('pic_rating'));

                $rowset = CPGPluginAPI::filter('thumb_caption_toprated',$rowset);

                return $rowset;
                break;

}


Thanks in advance for any help

Steve

Steve-R

Is this possible, can anyone shove me in the right direction?

Thanks in advance

Steve...:)

Steve-R

Am I not asking in the correct way? Is my question unclear? Can it not be done?

Its just its sat here (and so have I) for three days now and I wonder how it works exactly, do I need to clarify something/anything?

Regards

Steve...:)

Joachim Müller



Stramm

It's always nice to 'really' solve the thread and not just write 'solved'.
Other may find your solution useful, too.

Steve-R

Quote from: Stramm on November 15, 2007, 01:28:20 PM
It's always nice to 'really' solve the thread and not just write 'solved'.
Other may find your solution useful, too.

I couldn't agree more, but after 3 days..and then given a lame support link..I decided it was solved..as in it cant be done I had after all asked nicely and provided the code I was attempting to change and this was (IMO) all that was needed for my question..I even asked to be pushed in the right direction to enable me to work it out for myself. I can specify categories or its equivalent on other php softwares (forum stuff) but could not seem to get it working here. However it is just a couple of lines of code as I'm sure you probably know.And now I'll go at it from another angle.

In all honesty and with the greatest respect to all I say the best solution (on this occasion) was not to ask the question in the first place. Thereby solving the subject.

Steve