template:multitemplate
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
template:multitemplate [2011-06-18 13:52] – changed external links to dokuwiki.org to internal links ach | template:multitemplate [2020-09-19 12:14] (current) – Deleting page as I am retiring this template. tjgrant@tatewake.com | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Multitemplate for DokuWiki ====== | ||
- | ---- template ---- | ||
- | Author_mail: | ||
- | Description: | ||
- | LastUpdate_dt: | ||
- | Compatible: | ||
- | Template_tags: | ||
- | Screenshot_img: | ||
- | ---- | ||
- | ===== License ===== | ||
- | |||
- | * **Author:** [[tjgrant@tatewake.com|Terence J. Grant]] | ||
- | * **License: | ||
- | * **Last Update:** 2007-01-02 | ||
- | * **Donate:** [[https:// | ||
- | |||
- | It's not required, but please consider linking to [[multitemplate|this 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 [[# | ||
- | |||
- | After downloading, | ||
- | |||
- | * This is the **latest version**, compatible with **The Latest DokuWiki**: | ||
- | * Latest Version: {{http:// | ||
- | * Github URL: [[http:// | ||
- | |||
- | * Older downloads are available on request only. | ||
- | |||
- | **Note: http:// | ||
- | |||
- | ===== Installation ===== | ||
- | - [[# | ||
- | - unpack it into ''< | ||
- | - login as admin and change the template in the configuration manager | ||
- | |||
- | **using git:**\\ | ||
- | < | ||
- | % cd < | ||
- | % git clone git:// | ||
- | </ | ||
- | |||
- | **Debian install (or probably any other distribution): | ||
- | < | ||
- | # cd / | ||
- | # wget http:// | ||
- | # tar -xvzf multitemplate-stable.tar.gz | ||
- | # chown -Rv 33 multitemplate/ | ||
- | </ | ||
- | |||
- | **Note: http:// | ||
- | |||
- | ===== About ===== | ||
- | |||
- | This template allows you to use multiple templates in one DokuWiki installation, | ||
- | |||
- | For instance, you can have the monobook template for all of your site, roundbox template for user directories, | ||
- | |||
- | 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: | ||
- | |||
- | 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: | ||
- | <code php> | ||
- | $multitemplate[' | ||
- | $multitemplate['' | ||
- | </ | ||
- | |||
- | This makes it so that the " | ||
- | |||
- | Just add or remove lines as you see fit. Ok, so simple enough, right? | ||
- | |||
- | But there' | ||
- | |||
- | This will **not** work: | ||
- | <code php> | ||
- | $multitemplate[' | ||
- | $multitemplate[' | ||
- | $multitemplate['' | ||
- | </ | ||
- | |||
- | Why is this the case? Because ' | ||
- | |||
- | So here's what your local_pref.php would look like: | ||
- | <code php> | ||
- | $multitemplate[' | ||
- | $multitemplate[' | ||
- | $multitemplate['' | ||
- | </ | ||
- | |||
- | 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 [[: | ||
- | |||
- | 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 // | ||
- | * If they use // | ||
- | * Add the following line to the top of each .php file: | ||
- | <code php> | ||
- | <?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 ==== | ||
- | |||
- | <note warning> | ||
- | If you require **style.ini** support, there is also a **[[http:// | ||
- | </ | ||
- | |||
- | ===== Install ===== | ||
- | |||
- | Installation itself is simple, just unzip the file into the folder **lib/tpl** in your DokuWiki install, and add %%$conf[' | ||
- | |||
- | As with [[: | ||
- | |||
- | ===== 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 // | ||
- | |||
- | 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 " | ||
- | * Open a page that uses the " | ||
- | * Open a page that uses the " | ||
- | |||
- | You may notice that you'll end up with a section called " | ||
- | |||
- | ===== What's New ===== | ||
- | 01/02/2007: | ||
- | * Configuration Manager support | ||
- | |||
- | 11/03/2006: | ||
- | * Media manager support | ||
- | |||
- | 06/ | ||
- | * Figured out why "media file selection" | ||
- | |||
- | 06/24/2006: | ||
- | * Initial release | ||
- | |||
- | ===== Discussion ===== | ||
- | |||
- | * Start all subtopics using H2. (Heading 2.) | ||
- | |||
- | ===== Sites using this template ===== | ||
- | //Link your site here if you wish// | ||
- | * [[http:// | ||
- | Thank you very much for your outstanding work, in my opinion your [[: | ||
- | |||
- | Pasha | ||
- | |||
- | ===== Better way to integrate style.ini templates? ===== | ||
- | |||
- | >> If someone has a better way to integrate style.ini templates with multitemplate, | ||
- | |||
- | > I've created an action plugin solving the problem with style.ini: [[http:// | ||
- | |||
- | Awesome Pascal! I've added a link to this to the main page. --- // | ||
- | |||
- | ===== Careful with tplSwitcher (Template Switcher) ===== | ||
- | Don't use this plugin with multitemplate. In my case it caused chaos. | ||
- | |||
- | Peter | ||
- | |||
- | ===== Bug reading template configuration settings ===== | ||
- | When I'm using the sidebar-template, | ||
- | |||
- | Now I noticed that the current version of multitemplate is not able to aquire the configuration settings for sidebar, when it is used in a sub-namespace. | ||
- | |||
- | A quick-and-dirty workaround will help: | ||
- | |||
- | Modify ./ | ||
- | |||
- | // Workaround | ||
- | if (isset($ID) == FALSE) { | ||
- | $ID = getID(); | ||
- | } | ||
- | // /Workaround | ||
- | |||
- | It seems, that the $ID-Variable is never set, when this skript will be run. | ||
- | |||
- | Peter | ||
- | |||
- | ===== Multitemplate still broken for monobook? ===== | ||
- | |||
- | >Hi - I have just spent a few hours trying to get multitemplate working, and have finally found [[: | ||
- | > | ||
- | >Thanks much! [[http:// | ||
- | |||
- | Multitemplate is not broken, the fix for January was to do with the configuration manager. | ||
- | |||
- | My guess based on your problem is that you haven' | ||
- | |||
- | I've expressed my feelings regarding this buggy (and fairly useless) feature existing in DokuWiki, as well as it being on by default since it causes so many headaches (like caching the wrong CSS files when you change templates.) | ||
- | |||
- | Additionally, | ||
- | |||
- | I'm fairly confident this will fix your problems though. | ||
- | |||
- | >> Geez, it's even worse than I thought. Not only is it not broken but I'm a complete idiot. I accidentally uploaded the multitemplate to the wrong location (plugins not tpl) so obviously it was not working. Now it is! Like a charm!! Thanks much! [[http:// | ||
- | |||
- | ===== Multitemplate " | ||
- | |||
- | >>Hi - | ||
- | >> | ||
- | >> | ||
- | >> | ||
- | >> | ||
- | >> | ||
- | >> | ||
- | |||
- | > I found the cause of the " | ||
- | |||
- | If you're using multiple copies of the same template, which is something i really never expected, you'll have to change some things within the template' | ||
- | |||
- | - Search for the function name " | ||
- | * So for instance, if you find %%tpl_getConf(' | ||
- | - You'll then need to go to the " | ||
- | - You'll then want to do the same thing with " | ||
- | |||
- | I believe that should be enough to fix everything for you. --- // | ||
- | |||
- | You are right, Terence - many thanks! I got part of the way there myself a while after posting this.. see http:// | ||
- | |||
- | 1) Added the following to ~conf/ | ||
- | < | ||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | $conf[' | ||
- | </ | ||
- | |||
- | 2) Replaced the code as you suggested where they appear in these three files in the template: | ||
- | |||
- | context.php | ||
- | main.php | ||
- | lang/ | ||
- | |||
- | 3) And also updated the default.php and metadata.php files in the template/ | ||
- | [[http:// | ||
- | |||
- | ===== Template not applied ===== | ||
- | |||
- | >>Hi ! | ||
- | >> | ||
- | >>I would like to try Multitemplate for DokuWiki but, after the installation' | ||
- | >>To give more details, I used only two templates : the default template and a copy of this one, called " | ||
- | >> | ||
- | >> | ||
- | >>PS : Sorry if my english is not so good... I did my best but ask me if something is not clear in my explanation ! | ||
- | > | ||
- | >EDIT : I found the problem : default template needs style.ini file... So it needs multitemplate_styleman plugin... ;-) | ||
- | |||
- | ===== Bug report with latest version ===== | ||
- | |||
- | I believe I do have a bug report for multitemplate on rc2008-04-11. *Update: Same problem with 2008-05-05, same way to solve* | ||
- | If this was somehow my template' | ||
- | |||
- | I had a dokuwiki installation running multitemplate and the assistant plug-in with three different, self-made themes. | ||
- | |||
- | When I upgraded to rc2008-04-11, | ||
- | |||
- | I quickly determined this to be because multitemplate_styleman' | ||
- | Long story short, the error turned out to be in / | ||
- | |||
- | around line 44, you find | ||
- | |||
- | $tpl = trim(preg_replace('/ | ||
- | | ||
- | | ||
- | $tplinc = DOKU_INC.' | ||
- | $tpldir = DOKU_BASE.' | ||
- | } | ||
- | else | ||
- | | ||
- | $tplinc = DOKU_TPLINC; | ||
- | $tpldir = DOKU_TPL; | ||
- | } | ||
- | |||
- | $tpl needed to be false for my templates to work and the DOKU_TPLINC/ | ||
- | |||
- | Add the following lines directly below the first line quoted above ($tpl = trim...): | ||
- | |||
- | if ($tpl == " | ||
- | $tpl = trim(preg_replace('/ | ||
- | |||
- | Pekka (p@pekkagaiser.de) | ||
- | |||
- | > Pekka, I applied your patch but it seems not to help in my case. The web developer toolbar still shows CSS errors -- inside the multiteplate plugin, I still see %%__border__%% and other strings that should be defined in style.ini. | ||
- | >> solving my own issue... On [[plugin: | ||
- | |||
- | ===== Auto-update translated namespaces ===== | ||
- | |||
- | I use multitemplate and translations. I did not want to have to update the multitemplate settings for each language, so here is a small extension that automatically applies your $multitemplate settings to every language registered with the translation plugin. | ||
- | |||
- | Copy and paste at the very end of multitemplate/ | ||
- | |||
- | <php> | ||
- | | ||
- | /* Automatically adds all languages registered with the translation plugin | ||
- | to each and every $multitemplate entry. | ||
- | eg. with the languages Italian, German, and Dutch registered, the $multitemplate entry | ||
- | | ||
- | | ||
- | | ||
- | will become | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | | ||
- | |||
- | | ||
- | @author Pekka Gaiser < | ||
- | */ | ||
- | |||
- | if (isset($conf[' | ||
- | { | ||
- | |||
- | // Borrowed parsing routine for the " | ||
- | |||
- | $languages = strtolower(str_replace(',',' | ||
- | $languages = array_unique(array_filter(explode(' | ||
- | sort($languages); | ||
- | |||
- | /* Now we have all translation languages in an array. | ||
- | Each entry in $multitemplate will now be completed by an entry each language there is. */ | ||
- | |||
- | // We make a copy of $multitemplate to not confuse the loop | ||
- | |||
- | $multitemplate_tempCopy = $multitemplate; | ||
- | |||
- | // Go through every $multitemplate entry and there, through every language. | ||
- | |||
- | foreach ($multitemplate_tempCopy as $key => $value) | ||
- | { | ||
- | |||
- | foreach ($languages as $language) | ||
- | $multitemplate[$language.":" | ||
- | |||
- | |||
- | } // end foreach | ||
- | |||
- | unset ($multitemplate_tempCopy); | ||
- | |||
- | } // end if isset | ||
- | |||
- | </ | ||
- | |||
- | Pekka (p@pekkagaiser.de) | ||
- | |||
- | ===== Multitemplate breaks W3C validation of my template ===== | ||
- | |||
- | I do appreciate this template that lets me choose between dokuwiki' | ||
- | |||
- | >Sorry, I am unable to validate this document because on line 287 it contained one or more bytes that I cannot interpret as utf-8 (in other words, the bytes found are not valid values in the specified Character Encoding). Please check both the content of the file and the character encoding indication. | ||
- | > | ||
- | >The error was: utf8 " | ||
- | |||
- | The stranger part of the story is that W3C validator still validates [[http:// | ||
- | |||
- | What's wrong with my template used by multitemplate ? What can be done to that ? | ||
- | |||
- | |||
- | ===== Unwanted template changes when searching ===== | ||
- | |||
- | (I've just [[http:// | ||
- | |||
- | This is my test config: | ||
- | |||
- | <code php> | ||
- | $multitemplate[' | ||
- | $multitemplate[' | ||
- | $multitemplate['' | ||
- | </ | ||
- | |||
- | I visit the start page (// | ||
- | |||
- | * Search: ? | ||
- | * Go: ?id=foobar (shows the "This topic does not exist yet" page) | ||
- | |||
- | So far so good. But... since both include the parameter **id=foobar** in the URL, the displayed pages use the // | ||
- | |||
- | Same problem using as search term **id=foobarwhatever**, | ||
- | |||
- | ---efege, feb 27 2009 |
template/multitemplate.1308397930.txt.gz · Last modified: 2011-06-18 13:52 by ach