The reason I didn't recommend your approach is because the user slugs
are user definable. What if I wanted to call myself "6"? (I am not a
number...) You have to set a restriction on user slugs to include a
non digit character so as not to create issues. Your user slugs are
restrictive in that NO numbers could be used which would prevent me
from using my semi-common alias, gr66nman. But either solution is
viable, it's just important to be aware of the restrictions in doing
so.
On Thu, Jun 12, 2008 at 4:00 PM, b logica <[EMAIL PROTECTED]> wrote:
>
> It works for me. What's needed, though, is a regexp and then rules to
> ensure that the user-defined slug will match when it's created.
>
> /* matches underscore, hyphen, and lowercase alpha
> */
> Router::connect('/users/:user_slug',
> array('controller' => 'users', 'action' => 'view'),
> array('user_slug' => '[-_a-z]+')
> );
>
> Router::connect('/users/:user_id',
> array('controller' => 'users', 'action' => 'view'),
> array('user_id' => '[0-9]+')
> );
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---