I have the following code which includes another file in my main template. But I want to be able to include a file from a folder not the folder its currently set in. i.e. The current code below is for files located in the home directory. But I have another directory named "gaming" where a file called "reviews" resides. So I was to use something like this: index.php?gaming=reviews
I use this code like this which works fine:
index.php?id=main
<?
if(!file_exists("$id.php"))
{
include("main.php");
}else{
include("$id.php");
}
?>
I have tried something like this but don't work:
<?
if(!file_exists("/gaming/$gaming.php"))
{
include("main.php");
}else{
include("/gaming/$gaming.php");
}
?>
I cannot explain it any better, I have just started PHP. 😛
Feel free to explain anything to me I'm sure I will pick it up. 😉