Themes are a unique feature of Sodapop that allows developers to easily reskin their site while using the same set of controllers and models. It is also possible to serve different themes for different domains, making Sodapop an excellent option for hosted services.

How Themes Work

Themes consist of the user interface portions parts of the application: The /views, /layouts and /www directories. The first two contain template files and the latter contains static Javascript, HTML, images and CSS files.

These directories are placed in named directories within the application's /themes directory (for example /themes/my_clever_theme) and then the theme is added to either sodapop.json or programmatically through the Application object's setTheme() method.

At this point, Sodapop uses some internal logic to use the theme's template files for all views and layouts, and will automatically serve up the theme's static files when they are requested from the browser. For example, a request to:

will serve up the file located at /themes/my_theme/www/css/app_style.css.

Not Using Themes for Particular Controllers or Actions

Sometimes it is preferable to not use themes for particular controllers or controller actions, in hosted administration panels for example. These controllers and actions can be specified in the sodapop.json file using the theme_ignore_actions directive. Any controllers or actions listed there will use the application's /views, /layouts and /www directories rather than those of the theme.


If using themes, it is important that static files in the application's /www directory don't share the same name as files in the /themes/my_theme/www directory. If they do, we .htaccess rules will return them to the client before Sodapop has a chance to route the request correctly.

This can be easily accomplished through namespacing. For example, if the CSS files are placed in a directory called /www/admin/css and the theme's CSS files are placed in /themes/my_theme/www/css, they would not overlap.