Page 1 of 1

getting the name of the requested page from an included page

Posted: Mon Mar 19, 2007 12:30 am
by @modi
If you have one page that includes another, is there a way for the included file to access the name of the first page when it is requested? For example:

index.php:

Code: Select all

<?php include_once("navigation.php");?>
...
navigation.php:

Code: Select all

You requested page: <?php echo $requested_page?>.
Is there a way to make $requested_page contain the value "index.php" when navigation.php is included from index.php?

Posted: Mon Mar 19, 2007 1:16 am
by John Cartwright
you can define $requested_page in index.php

Posted: Mon Mar 19, 2007 6:43 am
by mentor
Look at this page http://www.php.net/get_included_files, specially comments by keystorm :at: gmail dotcom