I'm building a CakePHP site for a client and I've got a bit of an interesting problem. They want to add a new feature whereby users can create their own landing pages within the site using this type of URL: http://mainsite.com/username
. Since this is a Cake site, there are plenty of values for username
that would result in all sorts of routing craziness, especially if they happened to pick a username that was the same as a controller within the site.
My approach is something like this: in the beforeValidate
function of the Users controller, check the supplied username against a list of all of the controller names and return false
if there's a match. My question is - how can I get a list of all of the controller names (short of actually looping over the files in /app/controllers
)? Is it even possible to do this?
Thanks!