Page 2 of 2
Posted: Wed Jul 16, 2003 11:29 pm
by mabufo
but it gives you a clue... notice the
http://www.shiver7.com/out.php....
*cool website by the way
Posted: Wed Jul 16, 2003 11:40 pm
by Gen-ik
Ok.
You will also need to use PHP with each of your links then as well if you want a mouse-over display of the 'click' count.
For each link you will need to find out how many times that link has been clicked (see the previous code that has been posted to work out how).
Then on each link you add alt="Number of clicks: <?php echo($clicks); ?>"
and that should be that.
If you created your site by yourself then you shouldn't have any problems sorting this out. If you've just done a PHP cut 'n paste job on your site then it might be a bit harder.
Posted: Thu Jul 17, 2003 2:56 am
by Black Majin
Ok hey, I have the main.php in the home directory but I have the other files in another folder. So how would I do the alt code?

Cause I checked the txt file and it has the number of clicks everytime I click the link so I know that part works. Just need some help on showing it when mouse over.
Posted: Thu Jul 17, 2003 3:31 am
by Gen-ik
For each link you will need to pull the 'click' info into PHP from the txt files.. it's pretty much the same code as you use for the 'click' count updates.
(I take it the page with the links on it is has a .php extension else this won't work)
On all of the links which you have set-up to be recorded you need to add an ALT tag which basically tells the link to show some text when the mouse is rolled over it... so... an example link would look like this...
Code: Select all
<a href="links.php?sitename=name_of_site"><img src="theimage.gif" width=what_ever height=what_ever ALT="<?php dolink('name_of_site'); ?>"></a>
Notice we have PHP in the ALT tag which we can do as long as the page has the .php extension.
Now somewhere on your page (near the top is good) you need to add this code. What this code does is sort out the count info for each link.
If the .txt files are in a different folder to the webpage you will need to change the $PATH variable so that it points to the folder your .txt files are in.
Code: Select all
<?php
function dolink($sitename)
{
$PATH = "textfiles/";
//list of links
if($sitename=="site_name_one") { $countfile = $PATH."site_name_one.txt"; }
if($sitename=="site_name_two") { $countfile = $PATH."site_name_two.txt"; }
// open count file and read the current value
$fp=fopen($countfile,"r");
$count=fread($fp,filesize($countfile));
fclose($fp);
// now put the text we want to display in the ALT tag of the link.
echo("Link Count = ".$count);
}
?>
If everything is done correctly this should work ok.
Posted: Thu Jul 17, 2003 3:44 am
by Black Majin
ok now so ur sayin I have to have the code in the main.php and in the links.php?! Yeah i'm confused cause it says links.php in the url for the link but u also said to copy that code to the top of the page. Just making sure, do I do both?
Posted: Thu Jul 17, 2003 4:34 am
by Gen-ik
Yep you need the links to link to the links.php page which updates the clicks and sends the user to the relevant url. The code for this is the first lot (on the previous page).
The last lot of code (above) needs to go into the page where the links are.. basically the main website page. This will sort out the stuff needed to display the click-count using mouse-overs.
Make sense?
Posted: Thu Jul 17, 2003 2:38 pm
by AVATAr
Black Majin, try to learn something!. you ask how to register the clics. ok, for that use Gen-ik code.
Now this:
I mean I just dont see anywhere in that code where it shows the amount of clicks when u do a mouse over
is another problem!!!
read and try those codes before posting anything here