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: Number of pictures on my homepage  (Read 4510 times)

0 Members and 1 Guest are viewing this topic.

hama

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 229
Number of pictures on my homepage
« on: November 13, 2004, 05:09:58 pm »

Hi profs

I'd like to connect the number of pictures and the number of views to my homepage. Where are this two numbers stored?

With the forum it works now I'd like to do the same with the gallery.

Thanks for a little help

hama

Logged
Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!

Nibbler

  • Guest
Re: Number of pictures on my homepage
« Reply #1 on: November 13, 2004, 05:24:00 pm »

You can run simple SQL queries to get that info eg:

SELECT COUNT(*) FROM cpg_pictures
SELECT SUM(hits) AS total FROM cpg_pictures
Logged

hama

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 229
Re: Number of pictures on my homepage
« Reply #2 on: November 13, 2004, 07:06:24 pm »


Great, thanks.
Logged
Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!

hama

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 229
Re: Number of pictures on my homepage
« Reply #3 on: November 13, 2004, 09:42:40 pm »


That's a template for my startpage where I replicate some informations of the forum and now maybe (if it works) from the gallery:

Code: [Select]
<h3>Willkommen <a href="{BOARD}/profile.php?id=$_user[id]">$_user[name]</a></h3>
<ul>
    <li><a href="{BOARD}/user.php">Profil</a></li>
    <li><a href="{BOARD}/calendar.php">Kalender</a></li>
    <li><a href="{BOARD}/private.php">PN-Box</a> ($_user[pn_new])</li>
    <li><a href="{BOARD}/members.php">Benutzer</a> ($members)</li>
    <li><a href="{BOARD}/search.php?action=search&amp;get=new">Neue Beitr&auml;ge</a></li>

--> www.orst.ch (At the moment you can login with test test.)

Can you give me another hint what I can do with:

Code: [Select]
SELECT COUNT(*) FROM cpg_pictures
Code: [Select]
SELECT SUM(hits) AS total FROM cpg_pictures
Thanks a lot!  :)
Logged
Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Number of pictures on my homepage
« Reply #4 on: November 14, 2004, 01:25:33 pm »

If you want to have custom code on your front page, you're adviced to look up how to run queries in php - take a look at the php documentation. If this is alien to you I recommend searching the mods board, there are some mods that display stats and other content from the coppermine database on non-coppermine pages.

Joachim
Logged

hama

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 229
Re: Number of pictures on my homepage
« Reply #5 on: November 14, 2004, 02:41:29 pm »


It is alien to me ...  :-[ ...

Thanks anyway for your answer.
Logged
Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!

hama

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 229
Re: Number of pictures on my homepage
« Reply #6 on: November 15, 2004, 08:12:05 pm »


I have the solution (somebody helped me a bit ...).

--> http://www.orst.ch

--> The new part in the head.php is:

Code: [Select]
   // new Gallery DB
    $_gallery = new db($_cfg['DB_SERVER'], $_cfg['DB_GALLERY_USER'], $_cfg['DB_GALLERY_PASS'], $_cfg['DB_GALLERY_NAME']);
   
    // gallery_pics
    $gallery_pics = implode('', $_gallery->fetch_first('SELECT COUNT(*) FROM `cpg130_pictures`'));
   
    // gallery hits
    $gallery_hits = implode('', $_gallery->fetch_first('SELECT SUM(`hits`) FROM `cpg130_pictures`'));

--> The new part in the left_login.tpl is:

Code: [Select]
   <li><a href="http://www.dorfschule.ch/copper/index.php">Gallery-Fotos</a> ($gallery_pics)</li>
    <li><a href="http://www.dorfschule.ch/copper/index.php">Gallery-Views</a> ($gallery_hits)</li>

It works except that the homepage counts all the pictures and all the views (inclusive the private albums) and so the numbers are a bit different to the numbers in the gallery without a login. That's not so dramatic. Maybe you know a solution, if not it's not a problem. I just want to give you the code if someone else wants to do the same.

hama

Logged
Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 20 queries.