Been looking in stackoverflow for the answer or a hint to it but have not found what I am looking for, seems most of it is about sql stuff. Anyway my website is using Dynamic linking so the main index has all the html stuff and then the content box is the only thing that changed based on the php files I have in my pages folder.
I can access the php pages just fine but what I am trying to do is access php pages from within a directory inside the pages folder.
Most pages are linked using this which is just the about.php within the pages folder index.php?page=about
but how would I link other directories inside this pages folder? lets say I have the directory contact which has index.php inside it so /contact/index.php how would I link to that one?
This is the code I have so far for my content area of my site, a friend wrote it for me years ago and I can not contact him to get help now.
<?php
function open_page($string){
if (preg_match("/^[a-zA-Z]+$/", $string)){
$string = $string;
}else{
$string = "";
}
return $string;
}
$page = open_page($_GET['page']);
if ($page){
$file = "pages/".$page.".php";
if (file_exists($file)){
$pagename = $page;
}else{
$pagename = "404";
}
include("pages/".$pagename.".php");
}else{
echo 'ADD CONTENT HERE';
}
?>