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: adding a counter  (Read 10275 times)

0 Members and 1 Guest are viewing this topic.

moreli2

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
adding a counter
« on: October 11, 2004, 07:37:13 pm »

HI

On every page of my website I have a counter code, like this <?php
$chCounter_visible = "0";
include("/address/to/the/counter.php");
?>

I would like to have this counter on the startpage when people come in the gallery. I tried to put it in the theme.php, but then I get the message "data error". Can someone tell me where I should include this code and if I have to change something.

Thanks

Moreli2
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: adding a counter
« Reply #1 on: October 11, 2004, 10:14:50 pm »

put it into anycontent.php then. If you need it on every coppermine page, search the board for "custom header" or "custom footer" - this has been asked (and answered) before several times already.

Joachim
Logged

moreli2

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: adding a counter
« Reply #2 on: October 15, 2004, 10:27:40 am »

Well. I tried to put the counter now almost on every spot, but whatever I try it doesn't work properly. In the anycontent.php, which is almost empty, it has no results at all. If I put it in the theme.php under the pagefooter it counts correctly and every page seperately, but in the main page you will see 2 error php notes and a critical message that there is an error message in the database.

Actually I would like to have it in the anycontent.php, because I only want to see how many people visited the gallery, but where do I have to put this code and what do I have to chang`?

Greetings

Moreli2
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: adding a counter
« Reply #3 on: October 15, 2004, 12:46:57 pm »

can't say, as I don't know what the code you include actually does. As you even keep the error messages to yourself, you'll have to find the answer on your own as well. Usually such counter scripts are meant to be used on plain (static) pages, if the counter script tries to modify the header (for example), this is not possible in coppermine. I'm not a clairvoyant though, without actual code snippets, links and additional information there's little I (or anybody else on this board) could possibly do.

Joachim
Logged

Zeitgeist

  • Coppermine regular visitor
  • **
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 71
Re: adding a counter
« Reply #4 on: October 27, 2004, 08:17:04 am »

If you have it in anycontent and you can't see it, it probaly isn't working right. (the counter)

What I have in my anycontent2.php file is this:
Code: [Select]
<br /><div class="footer" align="center">
<?php include('count.php'); ?> visitors since Oct 26th, 2004

And that calls the counter, in count.php, and places it above the coppermine link line. The code for the count.php is:
Code: [Select]
<?
// This is a very simple counter which users 2 files.
// Upload both files.
// chmod hits.txt to 777
// include "count.php"; on the page to be counted.
// Thats it!
//------------------------------------------------------------------
$fil=fopen("hits.txt","r");
$antal=fgets($fil,1096); //read the first 1096 byte from file
fclose($fil);
echo $antal++; //print the number of visitors to the screen
$fil=fopen("hits.txt","w");
fwrite($fil,$antal);
fclose($fil);
?>

NOTE: I found this counter on the web elsewhere; but could not find out who the original author is. Make sure to upload hits.txt and chmod it 777

Hope this helps.
Logged
I love GauGau!

danielreidal

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: adding a counter
« Reply #5 on: June 15, 2007, 01:21:32 pm »

Hi! I'm trying this counter and it works if I starts the anycontent2.php in my web browser. But how do I call it from my html file?

Cheers Daniel
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: adding a counter
« Reply #6 on: June 24, 2007, 11:39:40 am »

PHP code doesn't work on static HTML pages. This is not support thread. Locking.
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 20 queries.