CodeIgniter Forums
twitter like urls - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: twitter like urls (/showthread.php?tid=26694)



twitter like urls - El Forum - 01-20-2010

[eluser]dadamssg[/eluser]
is it possible with codeigniter to have urls like twitter? I have a register form and id like the profiles to be located at mysite.com/a_user


twitter like urls - El Forum - 01-20-2010

[eluser]John Pantoja[/eluser]
what's Twitter?? LOL

Check out the url routing in the CI wiki, the force is strong with it.

I think social apps are the down fall of the web personally, one does not need to know the was of the farce to post useless information about their cat eating a cheezburger (yeah I'm a LOLCat fan)


twitter like urls - El Forum - 01-21-2010

[eluser]tomcode[/eluser]
I'd do :

1. config/routes.php
Code:
$route['default_controller'] = "welcome";
$route['scaffolding_trigger'] = "";
$route['(:any)'] = "welcome/$1";

2. controllers/welcome.php
Code:
function Welcome()
{
    parent::Controller();
}

function _remap($user)
{
    if($user == 'index')
    {
        $this->load->view('welcome');
    }
    else
    {
       // user related stuff
    }
}