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
-
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
-
You can run simple SQL queries to get that info eg:
SELECT COUNT(*) FROM cpg_pictures
SELECT SUM(hits) AS total FROM cpg_pictures
-
Great, thanks.
-
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&get=new">Neue Beiträ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:
SELECT COUNT(*) FROM cpg_pictures
SELECT SUM(hits) AS total FROM cpg_pictures
Thanks a lot! :)
-
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
-
It is alien to me ... :-[ ...
Thanks anyway for your answer.
-
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