Examples
sandbox2.pseudocoder.com
siteamonth.pseudocoder.com
Notes
- This component doesn't work if cache is enabled. All domains will get the cached view.
ReadMe
- You'll need a working version of CakePHP installed. This is running on 1.2.0.7692 RC3.
- Download the component and unzip the contents to app/controllers/components.
- Add the component to your /app/app_contoller.php so that it will work on every page:
var $components = array('LayoutSwitcher');
-
Create layout files for each domain you want to have a distinct look. The templates should be named domain.thtml and placed in the normal layout folder, /app/views/layouts. This site has layouts sandbox.pseudocoder.com.thtml and sandbox.siteamomth.com.thtml. Leave off the "www.".
Tips
- Make a symlink from default.thtml to the layout to be defaulted to in case someone reaches the site from some other url.
- Organize your CSS in a similar way to your layouts. The two stylesheets for this site are pseduocoder.style.css and sitamonth.style.css. You can have a third, common.style.css, that is included first for styles that are common to both sites.
- You can always override the automatically selected layout in your controller in the same way you'd override the default layout