Vilu Daskar
01-29-2005, 12:35 AM
I am looking for some help on expanding a PHP code that I am currently using. The script I have now, shown below, takes a txt file, and includes the header/footer beside it. So, index.php?p=main..
I am sure you have all seen this before. ;)
<?php { include("header.html"); }
if($p) {
$p = basename($p);
$p .= ".txt";
if (is_file("./$p")) {
include($p);
} else {
echo "The file you are looking for, index.php?p=$p is either not yet completed, or is missing.<br>Please keep looking back as I am constantly updating this section of the site.";
}
} else {
include("main.txt");
} { include("footer.html"); } ?>
My question is, can I get it to look through different folders for the txt files? As in, index.php?folder=test&page=main - which would turn out including /test/main.txt along with the header/footer.
I have seen this done on many different sites, but can't seem to figure it out!
Any help would be great!
~Vilu Daskar
I am sure you have all seen this before. ;)
<?php { include("header.html"); }
if($p) {
$p = basename($p);
$p .= ".txt";
if (is_file("./$p")) {
include($p);
} else {
echo "The file you are looking for, index.php?p=$p is either not yet completed, or is missing.<br>Please keep looking back as I am constantly updating this section of the site.";
}
} else {
include("main.txt");
} { include("footer.html"); } ?>
My question is, can I get it to look through different folders for the txt files? As in, index.php?folder=test&page=main - which would turn out including /test/main.txt along with the header/footer.
I have seen this done on many different sites, but can't seem to figure it out!
Any help would be great!
~Vilu Daskar