PRADO has intrinsic support for themes. By using themes, we can better separate logic and presentation, and we can also change the overall appearance of our blog system more easily.
We first create a new directory themes. This is the parent directory of all themes for a particular PRADO application. Any subdirectory under this directory will become a theme whose name is the subdirectory name.
To create a theme named Basic, we create a subdirectory theme/Basic. Under this directory, we may place theme-dependent stylesheet files, Javascript files, images, and skin files.
Under the themes/Basic directory, we create a CSS stylesheet file named style.css. When a page uses this theme, PRADO will automatically import this stylesheet to the page. The same occurs for Javascript files.
The CSS file is shown as follows.
We use skins to initialize the properties of PRADO controls. Skins are stored as skin files (suffix name .skin) under a theme directory. Each skin file can contain multiple skins for one or several types of control.
As a test, we will try to create a skin that changes the background color of the link buttons in the page footer. We create a file named button.skin under the theme directory themes/Basic.
The button.skin skin file contains only one skin for THyperLink controls whose SkinID property is MainMenu. The skin sets the background color of the control to be light-green.
Accordingly, we need to modify protected/common/MainLayout.tpl so that the link buttons in the footer use MainMenu as their SkinID.
To use the theme we just created, we modify the application configuration as follows. As we see, the Theme property for all pages is set as Basic, the name of the theme we created.
To see how our blog pages look like, visit the URL http://hostname/blog/index.php. We shall see the font, layout, borders are changed in the page. Also, the link buttons in the footer have light-green background.