2009/6/9 mapes911 <[email protected]>

>
> I've been wondering this for a while now about how Twitter/Myspace and now
> Facebook creates what they are calling "Vanity URLs"
>
> So, their users use their username as their url.
>
> ex. www.mydomain.com/myusername  would route to their user profile.
>
> So my question is, how can you accomplish this with Zend Framework AND
> still
> have other controller/action pairs as well?


I would use a custom route class for this (a class extending
Zend_Controller_Router_Route). In the match() method you then take the first
part of the URL and do a quick database query to see if that matches a
username. If it does, set appropriate parameters. If not, return false (and
the next route would be checked).

-- 
Tim Fountain
http://tfountain.co.uk/

Reply via email to