Possible Duplicate:
get name of current PHP script in include file
Can an included PHP file know where it was included from?
Does that headline make sense? :)
Can you determine the PHP
page that you put the <?php include 'SomeFile.php'; ?>
into, FROM THE INCLUDED PAGE??
In the page to be 'INCLUDED
' have an if statement based on the destination that grabs it?
Am I even saying this right?
Thanks All!
THE SOLUTION:
PAGEMAIN1.php
<?php
$MAIN2 ='';
$MAIN1 = 'MAIN1';
include 'PAGE1.php';
include 'PAGE2.php';
include 'PAGE3.php';
include 'PAGE4.php';
?>
PAGEMAIN2.php
<?php
$MAIN1 ='';
$MAIN2 = 'MAIN2';
include 'PAGE1.php';
include 'PAGE2.php';
include 'PAGE3.php';
include 'PAGE4.php';
?>
PAGE1.php
<?php
$PAGE1 = 'PAGE1';
if($MAIN1 == 'MAIN1'){
echo '(This is PAGE 1 being "INCLUDED" in MAIN 1)<br>';
}
if($MAIN2 == 'MAIN2'){
echo '(This is PAGE 1 being "INCLUDED" in MAIN 2)<br>';
}
?>
PAGE2.php
<?php
$PAGE2 = 'PAGE2';
if($MAIN1 == 'MAIN1'){
echo '(This is PAGE 2 being "INCLUDED" in MAIN 1)<br>';
}
if($MAIN2 == 'MAIN2'){
echo '(This is PAGE 2 being "INCLUDED" in MAIN 2)<br>';
}
?>
PAGE3.php
<?php
$PAGE3 = 'PAGE3';
if($MAIN1 == 'MAIN1'){
echo '(This is PAGE 3 being "INCLUDED" in MAIN 1)<br>';
}
if($MAIN2 == 'MAIN2'){
echo '(This is PAGE 3 being "INCLUDED" in MAIN 2)<br>';
}
?>
PAGE4.php
<?php
$PAGE4 = 'PAGE4';
if($MAIN1 == 'MAIN1'){
echo '(This is PAGE 4 being "INCLUDED" in MAIN 1)<br>';
}
if($MAIN2 == 'MAIN2'){
echo '(This is PAGE 4 being "INCLUDED" in MAIN 2)<br>';
}
?>
OUTPUT FROM PAGEMAIN1.php
(This is PAGE 1 being "INCLUDED" in MAIN 1)
(This is PAGE 2 being "INCLUDED" in MAIN 1)
(This is PAGE 3 being "INCLUDED" in MAIN 1)
(This is PAGE 4 being "INCLUDED" in MAIN 1)
OUTPUT FROM PAGEMAIN2.php
(This is PAGE 1 being "INCLUDED" in MAIN 2)
(This is PAGE 2 being "INCLUDED" in MAIN 2)
(This is PAGE 3 being "INCLUDED" in MAIN 2)
(This is PAGE 4 being "INCLUDED" in MAIN 2)
Just in case you wanted to know. ;) Thanks!