php include from subDir
- Started
- Last post
- 1 Response
- versa
can someone please help me...
i'm a php n00bi just want to call files from either the root, or if the file is in a subdirectory than from its subdirectory
i am using a block of php code on my index page and determining which content file to bring in on page load
the code is:
[?php
function getContent() {
if (empty($_GET['p'])) {
$p = 'home';
$p .= '.php';
} else {
$p = $_GET['p'];
$p .= '.php';
}
if ($_GET['sub']) {
$sub = $_GET['sub'];
$p .= $sub . '/' . $p . '.php';
}if (false == is_file($p)) {
$p = 'file_not_found.php';
}include($p);
}a link from one of the sections that i am trying to use to find files in teh subdirectory is:
[a href="index.php?p=rebecca&sub=st... onmouseover="return setStatus('')" onmouseout="return setStatus('')" title="Rebecca"]Rebecca Luna[/a]
thx for any advice and tips
- versa0
any help would be awesome...i think it is prolly simple