Number of pictures on my homepage Number of pictures on my homepage
 

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]

Main Menu

Number of pictures on my homepage

Started by hama, November 13, 2004, 05:09:58 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

hama

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

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

Nibbler

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

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

hama

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

hama


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


<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:

SELECT COUNT(*) FROM cpg_pictures

SELECT SUM(hits) AS total FROM cpg_pictures

Thanks a lot!  :)
Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!

Joachim Müller

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

hama


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

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

hama


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

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

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

   // 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:

   <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

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