Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Display total number of pictures in gallery?  (Read 3346 times)

0 Members and 1 Guest are viewing this topic.

jan_64

  • Coppermine newbie
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 7
    • Nature and Travel Photos
Display total number of pictures in gallery?
« on: January 09, 2008, 09:30:20 pm »

I would like to display the total number of pictures in my gallery (www.jangaeblerphoto.de) on the start page. I want to place it in the welcome text, that I have added in the template.html.

How can I get it? I only found a solution to display it in an external website (http://forum.coppermine-gallery.net/index.php?topic=26227.msg120914#msg120914).

Thanks for any help!
Logged

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: Display total number of pictures in gallery?
« Reply #1 on: January 09, 2008, 10:29:10 pm »

Code: [Select]
<?php
$result 
cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PREFIX']}pictures");
$num_files mysql_num_rows($result);

echo 
$num_files;

?>

I suggest using anycontent.php though, as it would be easier to implement PHP.
« Last Edit: January 10, 2008, 06:13:09 pm by just_some_guy »
Logged
Tambien, Hablo Espaņol      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Display total number of pictures in gallery?
« Reply #2 on: January 10, 2008, 08:17:58 am »

@just_some_guy: I understand that you're trying to help, but I told you before already: don't use proprietary mysql query syntax, but the one built into coppermine...
Logged

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: Display total number of pictures in gallery?
« Reply #3 on: January 10, 2008, 06:14:00 pm »

@just_some_guy: I understand that you're trying to help, but I told you before already: don't use proprietary mysql query syntax, but the one built into coppermine...

Sorry about that, i forgot. I have corrected my original posting.
Logged
Tambien, Hablo Espaņol      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

jan_64

  • Coppermine newbie
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 7
    • Nature and Travel Photos
Re: Display total number of pictures in gallery?
« Reply #4 on: February 07, 2008, 10:53:41 pm »

 ??? Could you please explain this code for a php newbie? I would like to appear the number in my introduction text, that I put into the html-template. Can put this code into the html template? How can I use anycontent.php for this?
Do I have to replace ['TABLE_PREFIX'] by some individual variable of my database?
Thanks for any help!

Code: [Select]
<?php
$result 
cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PREFIX']}pictures");
$num_files mysql_num_rows($result);

echo 
$num_files;

?>

I suggest using anycontent.php though, as it would be easier to implement PHP.

Logged

Nibbler

  • Guest
Re: Display total number of pictures in gallery?
« Reply #5 on: February 07, 2008, 11:18:48 pm »

Use something like this as your anycontent.php

Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2008 Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License version 3
  as published by the Free Software Foundation.
  
  ********************************************
  Coppermine version: 1.4.16
  $HeadURL: https://coppermine.svn.sourceforge.net/svnroot/coppermine/trunk/cpg1.4.x/anycontent.php $
  $Revision: 4233 $
  $Author: gaugau $
  $Date: 2008-02-02 09:23:58 +0100 (Sat, 02 Feb 2008) $
**********************************************/

/**
* Coppermine Photo Gallery 1.4.14 anycontent.php
*
* This file file gets included in the index.php if you set the option in admin
* can be used to display any content from any program, it is always to be edited
* according to tastes and then used
*
* @copyright 2002,2007 Gregory DEMAR, Coppermine Dev Team
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License V3
* @package Coppermine
* @version $Id: anycontent.php 4233 2008-02-02 08:23:58Z gaugau $
*/

if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

$result cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']}");
list(
$numpics) = mysql_fetch_row($result);

starttable("100%""Welcome");

?>

<tr><td class="tableb" >
Welcome, there are $numpics files in the gallery.
</td></tr>
<?php
endtable
();

?>


You don't need to modify it; just copy/paste. Then add anycontent into your config (content of the main page) setting.
Logged

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: Display total number of pictures in gallery?
« Reply #6 on: February 08, 2008, 09:39:56 am »

The "Welcome,..." line will just print out $numpics instead of a number.

Code: [Select]
<?php
echo "Welcome, there are "$numpics ." files in the gallery.";
?>

Logged
Tambien, Hablo Espaņol      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 20 queries.