Forums Sign Up Reply Search Statistics
Basic Statistics GraFX Software Solutions - Forum / Basic Statistics /

Help? Anyone?

 
Author ThePrynce
Guest
#1 Posted: 25 Mar 2005 07:00:18
Reply 
I have a question/idea or something along those lines...

See, I use a header and footer page for my layout on my site to cut back on filesize and trouble and all of that. That makes tracking each page individually a bit of a pickle. Does anyone know how I could log each page including the name?
I have a very limited knowledge of PHP so I don't know much of what I'm talking about so feel free to correct me or call me an inbecile as you see fit.

Ok, so on the whole deal with placing the script in the page, here's how it is:

<img src="statistics/stat.php?idnews=NAMEHERE&posted=2005:03:24" width="1" height="1">

Now, I was thinking I could pop in a little "<? echo basename($PHP_SELF); ?> where "NAMEHERE" is and it would do what I need but... alas, it does not.

So does anyone know how to do it correctly or in a way that you could show me?

Thanks in advance.

-=The Prynce
Author software
Admin
#2 Posted: 25 Mar 2005 09:01:55
Reply 
It should work with that.
But you need a name there better then an URL, but should work
Author ThePrynce
Guest
#3 Posted: 25 Mar 2005 09:52:10
Reply 
I don't know what I'm doing wrong but it doesn't work. In viewing the source, it shows this (which shows that it clearly isn't working):

<img src="statistics/stat.php?idnews=&posted=2005:03:24" width="1" height="1">

Using the 'basename' function strips it down to the name of the page minus the extension.

I agree that it should work but it doesn't. Any ideas? Maybe I'm doing one or two tiny little things off?

-=The Prynce
Author software
Admin
#4 Posted: 25 Mar 2005 12:33:18
Reply 
See in a phpinfo what variable is allowed to use.
Author theprynce
Guest
#5 Posted: 28 Mar 2005 02:00:28
Reply 
GOT IT!

Took me a few days, but I finally got it. It probably would have been easier if I knew more about PHP, lol.

Anywho, Just toss this before </BODY> in the footer page of your site if you use a header and footer and it will log each page as its name instead of having to type in the name in the IMG URL:

<?php
$nom = trim($_SERVER['PHP_SELF'],".php");
$finnom = trim($nom,"/");
//print ($finnom);
print ("<img src='statistics/stat.php?idnews=$finnom&posted=2005:03:24' width='1' height='1'>");
?>

Improvements are welcome as I'm sure they could be made, but this works FINE for me.

VICTORY!

-=The Prynce
Author software
Admin
#6 Posted: 28 Mar 2005 10:08:17 Edited by: Admin
Reply 
We are glad that you have managed :-)
 
Your Reply

» Username  » Password 
Only registered users are allowed to post here. Please enter your login/password details upon posting a message, or sign up first.