Dynamic Subdomains as Parameter
Hi everyone. I am working on a little project to learn more about Cake that involves using a "locale" as a sub domain. An example of a popular website that incorporates this type of functionality is craigslist. ex: pittsburgh.craigslist.org
I am running the latest version of Cake, 2.2.3 on a Lamp stack. My Vhost and DNS are configured for wildcard sub domains. I only want to use 1 App to handle all my subdomains.
To sum up why I am posting, I am confused on what the best way to setup my application to handle a sub domain as a parameter in my actions.
Lets say I have 3 baked Models: Locale, Category, and Thread. Locale and Category have many Threads.
When I am in the "view" of a single Thread, I want the sub domain to act as a parameter for the view action, so that I don't have to clutter the rest of my URL with arguments. Essentially, I would want my URL to look something like this. http://:locale.example.com/:category/:thread_id
I also had the idea of storing the Locale parameter as a session variable, but I am not sure if this is the best way to do it.
I know I need to use the router somehow to achieve this URL pattern, but I am not sure the best way to accomplish this.
Does anyone have any suggestions on the most efficient way to accomplish this?
Thanks! Cake is great, let me know if you are confused on my goal. I will elaborate more.
-treckstar
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home