coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: gelaskimgel on September 12, 2006, 01:22:45 PM

Title: How to show TopRated Picture and TopViewed Pictures?
Post by: gelaskimgel on September 12, 2006, 01:22:45 PM
Hey everybody...

Well by reading the subject, your can see the question... How can a take the TopRated picture and TopViewed pictures out of the Gallery section, and show them seperate on my page, but in another colomn... Webpage is: http://www.rdc.lir.dk/index.php (http://www.rdc.lir.dk/index.php) I want to have TopRated og TopVieweb pictures to be shown in the right column...


Many thanks....
Title: Re: How to show TopRated Picture and TopViewed Pictures?
Post by: gelaskimgel on September 12, 2006, 01:24:18 PM
I could se that the code for TopRated and TopViewed is this in functions.inc.php:

        case 'topn': // Most viewed pictures
                if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = $lang_meta_album_names['topn'].' - '. $CURRENT_CAT_NAME;
                } else {
                        $album_name = $lang_meta_album_names['topn'];
                }

                $query ="SELECT COUNT(*) from {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND hits > 0  $META_ALBUM_SET $keyword";

                $result = cpg_db_query($query);
                $nbEnr = mysql_fetch_array($result);
                $count = $nbEnr[0];
                mysql_free_result($result);

                //if($select_columns != '*') $select_columns .= ', hits, aid, filename, 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 hits > 0 $META_ALBUM_SET $keyword ORDER BY hits DESC, filename  $limit";
                $result = cpg_db_query($query);

                $rowset = cpg_db_fetch_rowset($result);
                mysql_free_result($result);

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

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

                return $rowset;
                break;

        case 'toprated': // Top rated pictures
                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 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;

Title: Re: How to show TopRated Picture and TopViewed Pictures?
Post by: Joachim Müller on September 12, 2006, 05:30:10 PM
You can't use Coppermine code outside of Coppermine, so it is irrelevant to quote the code of the function definitions in your second posting. There's a whole sub-board full of mods dedicated to display content taken from Coppermine on non-coppermine pages: Mods: content syndication (cpmFetch) (http://forum.coppermine-gallery.net/index.php?board=57.0)
Title: Re: How to show TopRated Picture and TopViewed Pictures?
Post by: gelaskimgel on September 15, 2006, 09:45:19 AM
anyone who can help?
Title: Re: How to show TopRated Picture and TopViewed Pictures?
Post by: Nibbler on September 15, 2006, 12:14:30 PM
Use http://forum.coppermine-gallery.net/index.php?board=57.0