For a project I'm using Arborint's (simplified) frontcontroller class (seen here). Using this class, one gets urls like
index.php?action=page
Now I would like to tackle the clean url issue before I go on. One option is to use mod_rewrite to rewrite them. However, I have a feeling there should be other ways.
Do I need to rewrite the frontcontroller class to deal with the url's?
For example, I found this function here:
Code: Select all
function url_parse() {
$url = $_SERVER[‘REQUEST_URI’];
// strip off get vars and anchor tags
if (strpos($url, ‘?’))
$url = substr($url, 0, strpos($url, ‘?’));
if (strpos($url, ‘#’))
$url = substr($url, 0, strpos($url, ‘#’));
//remove leading slash and possible trailing slash, store in $url
if (substr($url, 0, 1) == ‘/’)
$url = substr($url, 1);
if (substr($url, -1) == ‘/’)
$url = substr($url, 0, -1);
if ($url == ‘/’)
$url = ‘’;
$url = explode(‘/’, $url);
return($url);
}
$actions = Array(
“” => “front_page.php”,
“mail” => “mail.php”,
“member” => “profile.php”,
“messageboard” => “boards.php”,
);
url_parse();
$action = array_shift($url);
if (array_key_exists($action, $actions)) {
require($actions[$action]);
} else {
require(“404.php”);
}So that will make thing even more complicated. Any hints for directions I should look into?