Code snippets for symfony 1.x

Navigation

Support for Multiple Themes / Styles in Symfony

This will allow you to use multiple themes for symfony, each with it's own templates and stylesheets.

Download

Grab the code at GitHub: https://github.com/acetous/Symfony-Themed

New Directory for Templates

The templates have to be stored in sf_root_dir/themes/application/themename/module. A theme named default has to be present. Layouts have to be placed in sf_root_dir/themes/themename/application.

Example:

Stylesheets

Create stylesheets for your theme. You'll need to create one for each application.

Example:

Please include this stylesheets in your themes root directory. They need to be copied into the /web/css folder.

Only Change What You Need

All themes (except default) will load the default-templates if a custom one is not found. This way you just need to create the template files you want to alter.

Apart from that the default-stylesheet will be included if a custom one cannot be found.

Installation

Setup a Theme

Just run the ./symfony themed:setup task to setup all themes or ./symfony themed:setup name to setup a specific theme.

by acetous on 2011-07-09, tagged style  template  theme  view 

Comments on this snippet

gravatar icon
#1 qingnian du on 2012-02-13 at 05:48

hello,acetous: I want create a select options for users to change theme which they want show, How to do?

gravatar icon
#2 Denis Casanuova on 2012-05-01 at 07:08

Good work acetous! I work very fine! thanks

gravatar icon
#3 _gangrena_ on 2012-09-24 at 07:12

Hi acetous! Thanks for the snippet. Want to ask what about caching? Did you test it?