Themes inheritance


In Dotclear, themes inherit from one of 3 templates sets : mustek (used by default if the theme does not specify which set it inherits from), currywurst or dotty. If a theme does not provide specific versions of template files like home.html, post.html, category.html or others, Dotclear 2 will use the files available in the template set to render the pages.

Since Dotclear 2.1, you can specify what theme is the parent of another theme. A theme will be called child when it inherits from a parent theme. The child theme can use the template files from the parent theme, thus avoiding to duplicate all the tpl files.

This behavior is extended to PHP files:

  1. If the "child" theme includes a _public.php file, this one will be loaded.
  2. Then, if the "parent" theme also includes a _public.php file, this file will be loaded as well.

This will allow you to use new template tags and new URL managers in the child theme.

Search order of a template file when rendering:

  1. If the child theme has the required file, this file will be used.
  2. Else, if the parent theme has the requested file, this one will be used.
  3. If none of the above, Dotclear 2.x will do the usual search:
    1. first in the templates set,
    2. then in all other paths that might have been added by plug-ins.

Every tpl tag (like {{tpl:BlogThemeURL}}) will point to the child theme URL, even if it only appears in a template provided by the parent theme.


  • A theme can only inherit one other theme.
  • A theme cannot inherit a theme which already inherits another theme itself.

Set up

Everything is done in the _define.php file of the child theme:

        /* Name */                      "My amazing theme",
        /* Description*/                "Example theme based on Blue Silence",
        /* Author */                    "Pep",
        /* Version */                   '1.0',
        /* Parent ID */                 'blueSilence'

The "My amazing theme" theme is a child of the "Blue Silence" theme.


To define the parent theme, use the theme ID (its directory name, e.g. blueSilence), not its name (Blue Silence).

Wiki powered by Dokuwiki.