I'm busy to implement subdomains in a fancy way for a website. Also because I want to remove the controller name from the URL in any case I need to chose routes based on what I have in my URL it seems.
The idea was to use this for the subdomains: http://bakery.cakephp.org/articles/view/subdomaining-with-cake This is a very good way to use this, but you actually still have the controller name in your URL, and I actually want to use the URL also in that way, very nice for SEO. So actually I want to use the rewrite version and the normal version but domain.com/username/blog instead of domain.com/users/username/blog To accomplish this I need to chose routes based on what is asked in the URL, not always, but sometimes. My subdomains-names will be available in a Database so I need to query this one every time. This should also be done in the normal way to check if a user exists. Now I would like to use routes based on these queries, every hit on a subdomain will generate an qeury to the database, so I doubt if this is nice for the performance. The other question is; what is the best way to do a query from the router file ? I want to use the way under the part "Editing routes.php" in here: http://holisticnetworking.net/blog/2009/07/24/all-you-need-is-cakephp-and-routes-for-your-toots/ My idea is to replace the array with a query and base the whay how the if statement reacts on that. At this moment I use this to query the DB in the routes.php ClassRegistry::init('Users')->find('all', array('fields' => array ('Users.username')))); But is this the right way ? As I can't figure out what is allowed in the routes.php about this and there are not much docs about the ClassRegistry. So my questions are actually: What would be the best way to chose the routes based on: - Performance - Flexibility - Using a DB I hope my story is clear enough, thanks ! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
