I forgot to ask this in my question here: PHP Dynamic Include Help on Index.php?
How do I make it so directories are used with php includes? For example. I want to rename page2 to rules, then put the rules.php file into a folder called /rules/, so its now /rules/rules.php
As a result, the new url would be something like index.php?category=rules&id=rules
Here is the new code.
<?php
$page='';
if (isset($_GET['id'])){
$page = $_GET['id'];
}
$pageArray = array('index','css-pub1','page2','page3','page4','page5','page6');
$inArray = in_array($page, $pageArray);
if ($inArray == true) {
include(''. $page .'.php');
}
else {
include('main.php');
}
?>