if($page="page1")
include("folder1/index.php");
else
if($page="page2")
include("folder3/index.php");
else
if($page="page3")
include("folder3/index.php");
else
include("index.php");
any included files are execurted as text so if they have php statement they must have the <?php and ?> otherwise they will output as normal html files. Make sure all included files have .php extension