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
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
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
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
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:
<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:
<?
// 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.
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
PHP code doesn't work on static HTML pages. This is not support thread. Locking.