forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Themes/Skins/Templates => Topic started by: hama on November 13, 2004, 05:09:58 pm

Title: Number of pictures on my homepage
Post by: hama 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

Title: Re: Number of pictures on my homepage
Post by: Nibbler 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
Title: Re: Number of pictures on my homepage
Post by: hama on November 13, 2004, 07:06:24 pm

Great, thanks.
Title: Re: Number of pictures on my homepage
Post by: hama 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 (http://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!  :)
Title: Re: Number of pictures on my homepage
Post by: Joachim Müller 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 (http://www.php.net/mysql). 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
Title: Re: Number of pictures on my homepage
Post by: hama on November 14, 2004, 02:41:29 pm

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

Thanks anyway for your answer.
Title: Re: Number of pictures on my homepage
Post by: hama 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