I'm trying to implement a simple front controller in php.. In my index.php;
$parts = array_slice(explode('/',$_SERVER["REQUEST_URI"]),3);
if(file_exists($parts[0].'.php'))
include $parts[0].'.php';
else
echo 'not found';
so i typed the adress bar localhost/myroot/index.php/home, I expect to include home.php. It's include home.php but without external css files and javascript sources.. None of them are loaded..
in home.php,
<link rel="stylesheet" type="text/css" href="styles/master.css" />
<script type="text/javascript" src="scripts/master.js"></script>
root directory has styles and scripts directories /myroot/styles/master.css /myroot/scripts/master.js
so if i type localhost/myroot/home.php, it works correctly.