Connecting Tech Pros Worldwide Help | Site Map

Get Page Name

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 10:49 AM
rick.huby@e-connected.com
Guest
 
Posts: n/a
Default Get Page Name

I am updating a site that used to be in pure HTML.

On the original site each of the 5 or so sections had links on the
front page. When you enter a section the image for the link on the nav
changes to indicate which section you are in (head to
www.yorkshirelaser.co.uk to see what I mean).

I need to replicate this on the new PHP system but am using an include
file for the navigation, so I am unable to hardcode the relevent image
on the navigation. I don't really want to post things to the query
string so wondered if anyone has a solution for figuring out which page
I am on and getting the nav to choose the relevent image for the
current section.

This must be a typical issue in PHP web development so can anyone give
me the typical way of solving this?

Only way I can think of doing this is to set a variable in each page
just before I include the nav.php file, then use this to figure out
which section the user is in - but is there a better way?
Thanks for any and all advise.


  #2  
Old July 17th, 2005, 10:49 AM
Geoff Berrow
Guest
 
Posts: n/a
Default Re: Get Page Name

I noticed that Message-ID:
<1106170648.432107.204790@c13g2000cwb.googlegroups .com> from
rick.huby@e-connected.com contained the following:
[color=blue]
>
>I need to replicate this on the new PHP system but am using an include
>file for the navigation, so I am unable to hardcode the relevent image
>on the navigation. I don't really want to post things to the query
>string so wondered if anyone has a solution for figuring out which page
>I am on and getting the nav to choose the relevent image for the
>current section.[/color]

$_SERVER['PHP_SELF'] contains the name of the current page

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
  #3  
Old July 17th, 2005, 10:49 AM
steve
Guest
 
Posts: n/a
Default Re: Re: Get Page Name

"user2424" wrote:[color=blue]
> I noticed that Message-ID:
> <1106170648.432107.204790@c13g2000cwb.googlegroups .com> from
> rick.huby@e-connected.com contained the following:
>[color=green]
> >
> >I need to replicate this on the new PHP system but am using an[/color]
> include[color=green]
> >file for the navigation, so I am unable to hardcode the relevent[/color]
> image[color=green]
> >on the navigation. I don’t really want to post things to[/color]
> the query[color=green]
> >string so wondered if anyone has a solution for figuring out which[/color]
> page[color=green]
> >I am on and getting the nav to choose the relevent image for the
> >current section.[/color]
>
> $_SERVER[’PHP_SELF’] contains the name of the current
> page
>[/color]

and if you want the whole url, do:

$_SERVER[’PHP_SELF’] . "?" . $_SERVER[’QUERY_STRING];

note that if querystring is empty, then a "?" is added, if that is a
problem, run code to check for QS being present.

--
Posted using the http://www.dbforumz.com interface, at author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbforumz.com/PHP-Page-ftopict189432.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=640188
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.