LayoutsOn my old blog I kept a subdomain that I called the “sandbox”. It was a standard CakePHP installation, where I could post plugins or code that I intended to release. Since the old blog is deprecated, I wanted to port the sandbox to this blog, basically give it a design that matched. This is normally pretty straightforward, so to up the degree of difficulty I decided to keep the old design as well and automatically switch the layout based the domain.

To accomplish this I created a simple layout switcher component that determined the domain and uses that information to select the correct layout. All you have to do is include it in your controller and it will automatically do the rest.
Most likely you want to apply it to your whole site, so you should put it in your app_controller. Full instructions and downloads are available on the sandbox

Now if you go to sandbox.pseudocoder.com you’ll see a different layout then sandbox.siteamonth.com.

Popularity: 62% [?]