Welcome Guest, Not a member yet? Register   Sign In
How can I accomplish this? pls
#6

[eluser]my_immortal[/eluser]
Many thanks.
Now I have 3 solutions.
xwero.
Code:
$route['(help|forum)(.+)?'] = '$1$2';
$route[':any'] = 'profile/$1';
In .htaccess
Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(help|forum|contact) index.php?/$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/profile/$1 [L,QSA]
wiredesignz( but I change it a bit. cause i think lookup in database probably slow than array).
Code:
//in default controller.
function remap()
{
  $controller_name = $this->uri->segment(3); // Assume this is where the controller place.
  $reserve_file = array('help', 'forum', 'contact', .... 'user_setting')
  foreach($reserve_file as $file)
  {
    if(!file_exists($controller_name.'.php') && $controller_name != $file)
    {
       include 'profile.php';
    }else{
       include $file.'.php';  
    }
  }
}
Which is the best solution? About speed or perfomance.
Thanks for both guys.


Messages In This Thread
How can I accomplish this? pls - by El Forum - 01-25-2008, 02:44 AM
How can I accomplish this? pls - by El Forum - 01-25-2008, 02:52 AM
How can I accomplish this? pls - by El Forum - 01-25-2008, 03:36 AM
How can I accomplish this? pls - by El Forum - 01-25-2008, 04:50 AM
How can I accomplish this? pls - by El Forum - 01-25-2008, 05:10 AM
How can I accomplish this? pls - by El Forum - 01-25-2008, 06:04 AM
How can I accomplish this? pls - by El Forum - 01-25-2008, 06:22 AM
How can I accomplish this? pls - by El Forum - 01-25-2008, 07:02 AM
How can I accomplish this? pls - by El Forum - 01-25-2008, 07:32 AM
How can I accomplish this? pls - by El Forum - 01-25-2008, 07:43 AM
How can I accomplish this? pls - by El Forum - 01-25-2008, 08:32 AM
How can I accomplish this? pls - by El Forum - 01-25-2008, 03:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB