Im trying to make a menu in a mvc structure.. The problem is that i have the site in a subdir, in my web root like:
localhost/subdir/
but when i click i link it goes back to my root. the menu is called in a model(static at the momment), in a associative array where the key is the link name, and the value is the path name, like so:
$this->viewModel->set("mainMenu",array("Forside" => "/home", "Hjælp" => "/help"));
I when call it in a view file:
foreach ($viewModel->get('mainMenu') as $key => $values){
echo '<a href="'. $values. '">' . $key . '</a> ';
}
My .htaccess file:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^([a-zA-Z]*)/?([a-zA-Z]*)?/?([a-zA-Z0-9]*)?/?$ index.php?controller=$1&action=$2&id=$3 [NC,L]
I have tried to make my links with a backslash, that dosen't work.. I have tried to make the links with no slash that works alsong as I am in localhost/subdir/home , but when i go to localhost/subdir/home/view, and click the home link it just goes to localhost/subdir/home/home
I've have tried defining a BASE_ROOT, dosen't work. And same with defining my DIRECTORY_SEPARATOR don't work :(
Sorry for my bad english, i really hope someone can help me here.
index.phpand .htaccess? Are they in/subdir/OR at root level?