coppermine-gallery.com/forum

Support => Older/other versions => cpg1.3.x Support => Topic started by: Michael-CGC on February 06, 2005, 05:55:56 PM

Title: Top 10 albums
Post by: Michael-CGC on February 06, 2005, 05:55:56 PM
Hi there

Is there a way to call top 10 viewed albums ?

In advance thank you
Michael
Title: Re: Top 10 albums
Post by: Nibbler on February 07, 2005, 12:32:01 PM
SELECT aid, SUM(hits) AS numviews FROM {$CONFIG['TABLE_PICTURES']} GROUP BY aid ORDER BY numviews DESC LIMIT 10
Title: Re: Top 10 albums
Post by: Michael-CGC on February 07, 2005, 02:08:31 PM
Quote from: Nibbler on February 07, 2005, 12:32:01 PM
SELECT aid, SUM(hits) AS numviews FROM {$CONFIG['TABLE_PICTURES']} GROUP BY aid ORDER BY numviews DESC LIMIT 10

Where should add that code ? And is it possible just calling text?

Like:

Most viewed albums
1. xxxx
2. xxxx
3. xxxx
4. xxxx

... and so on
Title: Re: Top 10 albums
Post by: Nibbler on February 07, 2005, 02:28:58 PM
Depends where you want it. That's just the db query, you'd need extra code to display stuff. You can use this (http://forum.coppermine-gallery.net/index.php?topic=8405.msg61233#msg61233) code if you want it as an anycontent block, just switch that query for the one in my previous post and add formatting to display it as you want.
Title: Re: Top 10 albums
Post by: Michael-CGC on February 07, 2005, 02:31:57 PM
Quote from: Nibbler on February 07, 2005, 02:28:58 PM
Depends where you want it. That's just the db query, you'd need extra code to display stuff. You can use this (http://forum.coppermine-gallery.net/index.php?topic=8405.msg61233#msg61233) code if you want it as an anycontent block, just switch that query for the one in my previous post and add formatting to display it as you want.

erhm... Could you please explain in a newbie way ? What should exactly do and where do I add the code you gave me ?

In advance thank you
Michael
Title: Re: Top 10 albums
Post by: Michael-CGC on February 09, 2005, 10:23:03 AM
Nibller, are you there ?  :)
Title: Re: Top 10 albums
Post by: Hein Traag on February 09, 2005, 10:28:01 AM
Patience is a virtue  ;D

Why not trying something out yourself ? Take the anycontent block from the post nibblers suggests and try swapping the db query with the one he gave here. Trial and error is a good way of learning a thing or two about php coding.
Title: Re: Top 10 albums
Post by: Michael-CGC on February 09, 2005, 01:33:17 PM
Quote from: Hein on February 09, 2005, 10:28:01 AM
Patience is a virtue  ;D

Why not trying something out yourself ? Take the anycontent block from the post nibblers suggests and try swapping the db query with the one he gave here. Trial and error is a good way of learning a thing or two about php coding.

If I knew how to that, well... I wouldn't ask for a newbie help. Would I ? :-\\
Title: Re: Top 10 albums
Post by: Joachim Müller on February 10, 2005, 10:39:41 AM
Well, then you have to be more detailed in what you want to accomplish: where exactly are your top 10 meant to appear on what page? Links and illustrations/screenshots can be helpfull too...
Generic questions lead to generic answers, detailed questions usually lead to detailed answers.

Joachim
Title: Re: Top 10 albums
Post by: Michael-CGC on February 10, 2005, 07:16:11 PM
Hi Joachim

What I want to do is. I like to have a top x albums showing on my index.php (like the top viewed images black).
Title: Re: Top 10 albums
Post by: Joachim Müller on February 11, 2005, 01:12:14 PM
then use the query posted above and output the result, using anycontent.php. If this is too difficult for you, then maybe this mod is not meant for you, sorry...

Joachim