For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > September 2006 > Newbie question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Newbie question
Steve Ray

2006-09-30, 6:58 pm

Guys

I'm trying to write a function that will return that name of the page that
you are currently viewing (and ultimately save this to a file)

I want to then include this into a file that is included across the entirety
of my site. The idea behind this is so that I can monitor which are the
most popular pages on my site.

** I do not use a DB **

I've found the PHP_SELF constant but this permanently returns (blank) when I
display the contents of this onto the form

Am I looking at the wrong info ?

Ultimately can this be done ?

In anticipation

Steve

---------
We don't stop playing because we get old
We get old because we stop playing


petersprc@gmail.com

2006-09-30, 6:58 pm

You can get the current file with the __FILE__ constant.

If you're interested in an online service, Google Analytics is a
powerful, free web statistics application that's easy to integrate into
your site. More info here:

http://www.google.com/analytics/

Best Regards,

John Peters

Steve Ray wrote:
> Guys
>
> I'm trying to write a function that will return that name of the page that
> you are currently viewing (and ultimately save this to a file)
>
> I want to then include this into a file that is included across the entirety
> of my site. The idea behind this is so that I can monitor which are the
> most popular pages on my site.
>
> ** I do not use a DB **
>
> I've found the PHP_SELF constant but this permanently returns (blank) when I
> display the contents of this onto the form
>
> Am I looking at the wrong info ?
>
> Ultimately can this be done ?
>
> In anticipation
>
> Steve
>
> ---------
> We don't stop playing because we get old
> We get old because we stop playing


matthom@gmail.com

2006-09-30, 6:58 pm

> ** I do not use a DB **

There's gonna have to be a DB in there somewhere. Out of curiousity,
why don't you use a DB?

Also, if you're looking to track page visits - believe me, you don't
want to do this by hand, like you're suggesting. Another member
mentioned Google Analytics. Also, Mint (http://www.haveamint.com/) is
good too.


Steve Ray wrote:
> Guys
>
> I'm trying to write a function that will return that name of the page that
> you are currently viewing (and ultimately save this to a file)
>
> I want to then include this into a file that is included across the entirety
> of my site. The idea behind this is so that I can monitor which are the
> most popular pages on my site.
>
> ** I do not use a DB **
>
> I've found the PHP_SELF constant but this permanently returns (blank) when I
> display the contents of this onto the form
>
> Am I looking at the wrong info ?
>
> Ultimately can this be done ?
>
> In anticipation
>
> Steve
>
> ---------
> We don't stop playing because we get old
> We get old because we stop playing


Kim André Akerĝ

2006-09-30, 6:58 pm

Steve Ray wrote:

> Guys
>
> I'm trying to write a function that will return that name of the page
> that you are currently viewing (and ultimately save this to a file)
>
> I want to then include this into a file that is included across the
> entirety of my site. The idea behind this is so that I can monitor
> which are the most popular pages on my site.
>
> ** I do not use a DB **
>
> I've found the PHP_SELF constant but this permanently returns (blank)
> when I display the contents of this onto the form
>
> Am I looking at the wrong info ?
>
> Ultimately can this be done ?


If you're looking for a *constant* named PHP_SELF, then you might be
barking up the wrong tree (since it's not a predefined constant).

If that's the case, try instead with $_SERVER["PHP_SELF"], or even the
constant __FILE__.

http://php.net/language.variables.predefined
http://php.net/language.constants.predefined

--
Kim André Akerĝ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com