Before reading this section, you may wish to read the "Themes" page in the admin documentation:
<metadot>/doc/md_guides/install/themes.html
so that you are familiar with the user interface and basic functionality. Selecting "Themes" as the site's Style provides an interface where page layout is fixed, but site colors, text colors, and header logos can be modified easily.
There is not currently a browser-based interface for modifying the template HTML for a given Theme, nor a browser-based interface for switching between Themes, particularly with respect to switching between alternate HTML layouts. (Other theme parameters can be modified via the Themes Styles & Colors interface). However, the underlying code and database structure for themes supports defining more than one theme (in terms of its color settings and HTML templates), and then using a specified theme as the Theme for the site. [An admin browser interface, to provide access to the Themes html, is planned for the future].
With some work, it is possible to create or modify a site's Themes without a browser-based interface, but for a given site, you may not have the need to do this. If you simply need to develop a new "look" for the site, it will probably be sufficient if you select Style 4 from the Styles and Colors configuration page, instead of themes; then modify the Style 4 template layout and gizmo tags as described in Section 8 .
If, however, you want to change the HTML templates for a Theme, this can be done without too much difficulty via your database client interface.
Look at the value of the
template_theme
parameter in the params table, by running the following query (from a mysql client interface):
select * from params where name = 'template_theme';
This query shows you the name of the current theme, e.g.
theme2
.
(For the current Metadot release, the '
theme2
' template is in use).
Then look at the themes definitions in the
themes
database table. E.g., enter the following query:
select theme, pname from theme;
You will see configuration information for one or more themes. For a given theme, the value fields for the following parameters hold template HTML:
theme_maintemplate, theme subtemplate
, and
theme_utilitytemplate
. In addition, the value fields for the following parameters hold page header HTML:
theme_adminheader
, and
theme_simpleheader
. Additional fields hold color and logo settings for the Theme. These fields can be viewed as the "configuration set" for a given Theme.
For a given theme, the three theme templates are roughly equivalent to the Style 4 Main Template, Sub-Template, and Utility Template defined in the Advanced Styles and Colors page, in that they both use GizmoTags to place content in specified locations on the page. However, there is one key difference: the Themes templates contain specialized gizmo tags which insert Template-Toolkit-derived HTML fragments based on the current theme's parameter settings.
The three specialized gizmotags are the modules:
<metadot>/metadot/GizmoTag/md_theme1*.pm
.
These sub-templates control the header and left-nav-bar layout for the theme, as well as the style rules for the theme. The Template-Toolkit templates used by these gizmotags are in
<metadot>/metadot/Metadot/templates
, and these files utilize information about the current theme's parameters, such as the current header logo used by the theme, in order to generate HTML fragments specific to that the current theme.
This implementation has two important implications.
First is that the specialized gizmotags, which construct HTML using the Theme's parameters (e.g., navbar color and text), are providing the "hooks" to the color and logo values set in the Styles & Colors page. If you want to replace the Themes HTML, you will need to retain these gizmotags (or build similar ones) in order to have the site pages change properly when the Styles & Colors settings change.
Second, since some Themes HTML content comes from the static Template-Toolkit files used by these specialized gizmotags, then this means that there are some aspects of Themes page layout that are encoded in static files, not in the database. An example is the left-nav-bar width generated by the
md_theme1_lefttable.pm
gizmotag. In a virtual server setup, with multiple Metadot servers running off the same code base, all virtual servers will share the same Template-Toolkit template files. You will need to make new gizmotags if you want to make a change to one of these Template-Toolkit files for just some of your virtual sites; e.g., if you want to use Themes mode for all your sites, but change the left-nav-bar width for the Themes layout in only one of your virtual sites. (This limitation will be addressed in a future release; however, note that if you want to change the layout or look for one virtual site, you can do this straightforwardly using Templates/Style 4 rather than Themes for that site, as described in Section 8).
To change a Theme's HTML, you may need to modify either the HTML strings stored in the themes table for that theme (the
theme_maintemplate, theme_subtemplate
, or
theme_utilitytemplate
strings), or modify one of the Template-Toolkit template sub-files used by the special gizmotags, as described above. The location of the modification will depend upon what aspect of the page's layout you need to change. For example, if you want to change some aspect of the header HTML, or the Theme's CSS definitions, this will require changing a sub-template file. If you want to change the width of the center 'content panel', this is defined in the HTML strings stored in the database.
Using your MySql client interface, you can examine and modify the HTML strings for a given theme. The three HTML strings --
theme_maintemplate, theme_subtemplate
, and
theme_utilitytemplate
-- are the templates used for the front page, other site pages, and non-page gizmos, respectively, when Themes mode is enabled.
The two header HTML parameters --
theme_adminheader
and
theme_simpleheader
, are used for various form and admin pages. They contain "hooks" to utilize the Themes banner image settings. You probably will not need to modify them.
If you like, you can create a new theme configuration set by defining a new name for the theme, and adding its parameters to the
theme
table by inserting new records with the 'theme' field set to your new theme name. If you do this, it is best to use the configuration set of an existing theme as a starting point. When you have completed the new Theme, you can configure your site to use it by updating the params table:
update params set value = `<new theme name>' where name = `template_theme'