View Full Version : Rooting Or Indexing

05-18-2008, 08:12 AM
Which is the best way to create a rooting or indexing system.

i.e forum/posts/22
by going to this url how to display the 22 id post

and by going to forum/posts/22/edit
go to editing the 22nd post.

the method i have come across is as follows

.htaccess in the root directory

RewriteEngine On
RewriteRule !(\.gif|\.png|\.jpe?g|\.css|\.js|\.php|^public/.*)$ index.php [nocase,last]

index.hp also in the root directory using the following method

// Requested URL

// Removes Apllication root from url
$url = str_replace('/tumblelog/', '', $url);


$routes = array(
array('url' => '/^posts\/(?P<id>\d+)$/', 'controller' => 'posts', 'view' => 'show'),
array('url' => '/^posts\/(?P<id>\d+)\/edit$/', 'controller' => 'posts', 'view' => 'edit')

$params = array();

$route_match = false;

foreach($routes as $urls => $route)
if(preg_match($route['url'], $url, $matches))
$params = array_merge($params, $matches);
$route_match = true;

if(!$route_match) { exit('no route found'); }

//print('controller: '.$route['controller'].' view:'.$route['view'].' id:'.$params['id']);

//echo $url;


CAN some one tell me if this is the correct method else direct me to the right resouces

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum