Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Top 10 albums  (Read 5419 times)

0 Members and 1 Guest are viewing this topic.

Michael-CGC

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Top 10 albums
« 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
Logged

Nibbler

  • Guest
Re: Top 10 albums
« Reply #1 on: February 07, 2005, 12:32:01 pm »

Code: [Select]
SELECT aid, SUM(hits) AS numviews FROM {$CONFIG['TABLE_PICTURES']} GROUP BY aid ORDER BY numviews DESC LIMIT 10
Logged

Michael-CGC

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: Top 10 albums
« Reply #2 on: February 07, 2005, 02:08:31 pm »

Code: [Select]
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
Logged

Nibbler

  • Guest
Re: Top 10 albums
« Reply #3 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 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.
Logged

Michael-CGC

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: Top 10 albums
« Reply #4 on: February 07, 2005, 02:31:57 pm »

Depends where you want it. That's just the db query, you'd need extra code to display stuff. You can use this 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
Logged

Michael-CGC

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: Top 10 albums
« Reply #5 on: February 09, 2005, 10:23:03 am »

Nibller, are you there ?  :)
Logged

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Re: Top 10 albums
« Reply #6 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.
Logged

Michael-CGC

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: Top 10 albums
« Reply #7 on: February 09, 2005, 01:33:17 pm »

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 ? :-\\
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Top 10 albums
« Reply #8 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
Logged

Michael-CGC

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: Top 10 albums
« Reply #9 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).
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Top 10 albums
« Reply #10 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
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 19 queries.