22
For anyone who is interested. This is how I implemented a clean URL structure before and what I'm attempting to hack into xoops.
.htaccess file I have following
le="color: #000000"><?php RewriteEngine On # If they are looking for index.php we're done RewriteRule ^(index.php.*) $1 [L] # If they are looking for a file with a file extension let them get at it RewriteRule ^(.*..+)$ $1 [L] # Otherwise send their request to index.php RewriteRule ^(.*)$ index.php?query=$1 [L]
Then I include the following script which basically takes whatever is stuck in the URL and sticks it in an array called $page_query
le="color: #000000"><?php global $REQUEST_URI; global $SCRIPT_NAME; $base_href = $SCRIPT_NAME; $path = explode("/",$base_href); $template = array_pop ($path); $path = implode ("/",$path); $vars = str_replace($SCRIPT_NAME, "", $REQUEST_URI); $array = explode("/",$vars); $num = count($array); // How many items in the array? for ($i = 1 ; $i < $num ; $i++) { $page_query[$i] = $array[$i]; }
From here I have a simple configuration array which is used to define what I need to include and I provide definition for the variable passed in my query string.
le="color: #000000"><?php $page_content[1]['name'] = 'products'; $page_content[1]['source'] = 'products/index.php'; $page_content[1]['group'] = $page_query[1]; $page_content[1]['page_func'] = $page_query[2]; $page_content[1]['item_id'] = $page_query[3]; $page_content[2]['name'] = 'news'; $page_content[2]['source'] = 'news/index.php'; $page_content[2]['group'] = $page_query[1]; $page_content[2]['category'] = $page_query[2]; $page_content[2]['article_id'] = $page_query[3]; ect..
The array method above could be customized to what ever is required and you could pass as number of variables in your query string as you want.
I really like this approach. It's proved very effective. Ultimately I ran into problems caching my templates and providing good group based access to my site, so I came searching and found xoops.
So now I have to try and hack this into the core and see if I can get it working.
If anyone thinks I'm crazy or has suggestions please let me know :)