Welcome Guest, Not a member yet? Register   Sign In
URL Rewriting: Name instead of ID
#6

[eluser]perfectsam[/eluser]
[quote author="WanWizard" date="1279641818"]
Thank you all for your solutions.

@WanWizard
My structure is indeed as you described. I took your solution and my code looks like this now:
Code:
if (is_numeric($author_id))
    {
        $author = $this->author_db->getByID($author_id);
        redirect('authors/show/'.$author->getName());
    }
    else
    {
        $author = $this->author_db->getByName($author_id);
    }

Now I only have to write a function that converts the name (+special chars) into a conform URL segment, e.g. John Doe -> john_doe


Messages In This Thread
URL Rewriting: Name instead of ID - by El Forum - 07-20-2010, 04:50 AM
URL Rewriting: Name instead of ID - by El Forum - 07-20-2010, 05:03 AM
URL Rewriting: Name instead of ID - by El Forum - 07-20-2010, 05:05 AM
URL Rewriting: Name instead of ID - by El Forum - 07-20-2010, 05:05 AM
URL Rewriting: Name instead of ID - by El Forum - 07-20-2010, 07:20 AM
URL Rewriting: Name instead of ID - by El Forum - 07-20-2010, 06:41 PM
URL Rewriting: Name instead of ID - by El Forum - 07-20-2010, 07:25 PM
URL Rewriting: Name instead of ID - by El Forum - 07-21-2010, 01:16 AM
URL Rewriting: Name instead of ID - by El Forum - 07-21-2010, 05:57 AM
URL Rewriting: Name instead of ID - by El Forum - 07-21-2010, 06:00 AM
URL Rewriting: Name instead of ID - by El Forum - 07-21-2010, 06:08 AM
URL Rewriting: Name instead of ID - by El Forum - 07-21-2010, 06:11 AM
URL Rewriting: Name instead of ID - by El Forum - 07-21-2010, 07:54 AM
URL Rewriting: Name instead of ID - by El Forum - 07-21-2010, 07:58 AM
URL Rewriting: Name instead of ID - by El Forum - 07-21-2010, 12:25 PM
URL Rewriting: Name instead of ID - by El Forum - 07-26-2010, 10:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB