Multitemplate for Dokuwiki

License

It's not required, but please consider linking to this page or the main page from your site if you like this product.

Download

Before downloading or using this product, make sure you understand and accept the terms of the license.

After downloading, make sure to follow the instructions below; you will not be able to use the template otherwise.

  • This is the latest version, compatible with the current DokuWiki:
  • These are unsupported versions, compatible with DokuWiki 2006-03-09:
    • Previous Version: Multitemplate for Dokuwiki - November 3, 2006
    • Previous Version: Multitemplate for Dokuwiki - June 24, 2006 release b
    • Initial Version: Multitemplate for Dokuwiki - June 24, 2006

About

This template allows you to use multiple templates in one DokuWiki installation, based on what the path to any particular page begins with.

For instance, you can have the monobook template for all of your site, roundbox template for user directories, SXS for discussions, and default for the playground.

Better yet, if you're making a customized site, you can simply make different templates for different sections.

In fact, you can even use custom templates for individual pages; so you could make playground:playground have another custom template that would be different from other pages in the playground namespace.

So there you have it. Now let's see how to configure it.

The $multitemplate Variable

The $multitemplate variable is your way to configure which templates get applied to which pages on your website. All you simply need to do is edit local_pref.php in the multitemplate folder.

Here is the default configuration:

$multitemplate['playground'] = 'default';
$multitemplate[''] = 'monobook';

This makes it so that the "default" template gets applied to the playground namespace, or any path/file that begins with "playground". Then, anything that doesn't match, by default, gets the "monobook" template.

Just add or remove lines as you see fit. Ok, so simple enough, right?

But there's one thing to consider– lets say that we want to use a different template for a page that is located at "playground:test".

This will not work:

$multitemplate['playground'] = 'default';
$multitemplate['playground:test'] = 'roundbox';
$multitemplate[''] = 'monobook';

Why is this the case? Because 'playground:test' will match against 'playground' first, and then terminate. So the rule to remember is, longer namespaces go first. That means 'playground:test' comes before 'playground'.

So here's what your local_pref.php would look like:

$multitemplate['playground:test'] = 'roundbox';
$multitemplate['playground'] = 'default';
$multitemplate[''] = 'monobook';

So, is that all the configuration you need to do? No, keep reading!

How to modify your templates

Here is the last part. You must modify your templates first because of the way multitemplate works.

The latest version of Monobook for Dokuwiki will already work with multitemplate as is.

For some templates, or templates you make yourself, you'll only need to do a few things:

  • Open each .php file in the template and replace DOKU_TPL with $DOKU_TPL
    • If they use DOKU_TPLINC, replace with $DOKU_TPLINC as well
  • Add the following line to the top of each .php file:
<?php if (isset($DOKU_TPL)==FALSE) $DOKU_TPL = DOKU_TPL; if (isset($DOKU_TPLINC)==FALSE) $DOKU_TPLINC = DOKU_TPLINC; ?>

And that's it, now it is multitemplate ready. Also, this will allow the template to work stand-alone or with multitemplate.

Style.ini

If you require style.ini support, there is also a style.ini helper plugin for Multitemplate by Pascal Bihler that you will need to install.

Install

Installation itself is simple, just unzip the file into the folder lib/tpl in your DokuWiki install, and add $conf['template'] = "multitemplate"; to your local.php file, which is located in the conf folder in your DokuWiki install.

As with Monobook for Dokuwiki, I suggest you turn off "Compress CSS and javascript files" because it's a buggy feature in DokuWiki.

Additional Notes

  • In general, any time you change templates, make sure you do a force-refresh on your website. You can do this in FireFox and Internet Explorer by holding shift-control-alt and clicking the refresh button. This flushes the browser's copy of any cached content (particularly stylesheets) on whatever site you're on, so you'll get the latest copy.

If one or more of your templates use the configuration manager, you will need to open the configuration manager and configure the template for each different template you have.

In other words, if you use the templates "monobook" and "default", you will need to:

  • Open a page that uses the "monobook" template, click admin, then click configuration settings, and set your preferences for this template.
  • Open a page that uses the "default" template, click admin, then click configuration settings, and set your preferences for this template. 1)

You may notice that you'll end up with a section called "Undefined settings"; this is normal though.

What's New

January 2, 2007

  • Configuration Manager support

November 3, 2006

  • Media manager support

June 24, 2006 - b

  • Figured out why "media file selection" didn't work and fixed it.

June 24, 2006

  • Initial release
1)
I don't believe the default template has configuration settings, but you get the point, right?
Print/export
QR Code
QR Code Multitemplate for Dokuwiki (generated for current page)