Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
public:computers:dokuwiki_tweaks [09/01/26 19:24 GMT] – [Acronyms & Abbreviations] johnpublic:computers:dokuwiki_tweaks [02/02/26 18:19 GMT] (current) john
Line 2: Line 2:
  
 ====== DokuWiki Tweaks ====== ====== DokuWiki Tweaks ======
 +===== Vector / Monobook tweaks =====
  
 +I like the Vector and Monobook templates, very similar feel to Wikipedia
 +
 +==== Logout errors with later versions of Dokuwiki ====
 +
 +After upgrading Dokuwiki to //Igor// it became impossible to log out due to a warning 
 +
 +<note warning>
 +Security Token did not match. Possible CSRF attack.
 +</note>
 +
 +I initially ignored it but then downgraded back to //Hogfather// as there seemed to be no fix - other than to use a different template.
 +
 +I recently upgraded to the latest Dokuwiki (Jack Jackrum), and upgraded all plugins and templates where possible. However the problem with logout with Vector and Monobook re-appeared.
 +
 +I found there was a fix described on the forum:
 +
 +[[https://forum.dokuwiki.org/d/20248-security-token-did-not-match-possible-csrf-attack-cannot-log-out]]
 +
 +and the cure is to edit the appropriate line in ''main.php'' for each template, as the author seems not to be maintaining these templates any more, at least not the official ones accessed via Dokuwiki's Template/Extension installer. The github repository shows that the fix has been applied to ''Vector'', and a pull request submitted to fix ''Monobook'', the fixes haven't appeared in the official versions. 
 +
 +The FIXME does work, though...
 +
 +For Vector edit ''/var/www/html/dokuwiki/lib/tpl/vector/main.php'' to add '', 'sectok' => getSecurityToken()'' in the ''array'' statement after ''"do" => "logout"''
 +
 +<code php>
 + echo      <li id=\"pt-logout\"><a href=\"".wl(cleanID(getId()), array("do" => "logout", 'sectok' => getSecurityToken()))."\" rel=\"nofollow\">".hsc($lang["btn_logout"])."</a></li>\n"; //language comes from DokuWiki core
 +
 +</code>
 +
 +and the same for ''Monobook''
 +<code php>
 + echo          <li id=\"pt-logout\"><a href=\"".wl(cleanID(getId()), array("do" => "logout", 'sectok' => getSecurityToken()))."\" rel=\"nofollow\">".hsc($lang["btn_logout"])."</a></li>\n"; //language comes from DokuWiki core
 +
 +</code>
 +
 +
 +==== Monospace font ====
 +
 +I found the style applied to ''monospace'' text was a little underwhelming. 
 +
 +I found the place to change it:
 +
 +'' /var/www/html/dokuwiki/lib/tpl/{vector|monobook}/user/screen.css ''
 +
 +add the the following and adjust as needed:
 +
 +<code css>
 +
 +div#content .dokuwiki code {
 +  font-size: 100%;
 +  padding-left: 5px;
 +  padding-right: 5px;
 +  background-color: #eee;
 +  color: #00f;
 +  direction: ltr;
 +  text-align: left;
 +}
 +
 +
 +</code>
 +
 +==== Footer Buttons ====
 +
 +Remove the default footer buttons by editing ''{vector|monobook}/user/buttons.php'' and adding
 +
 +<note tip>
 +For Monobook, change to <code>$_monobook_btns = array();</code>
 +</note>
 +
 +<code php>
 +
 +//delete all (defaults)
 +$_vector_btns = array();
 +</code>
 +
 +this suppresses the inclusion of footer buttons from ''vector/conf/buttons.php''
 +
 +=== Add just the Dokuwiki and Vector/Monobook Buttons ===
 +
 +Edit ''{vector|monobook}/user/buttons.php''
 +
 +<note tip>
 +Swap ''monobook'' for ''vector'' as appropriate
 +</note>
 +
 +<code php>
 +
 +<?php
 +
 +//check if we are running within the DokuWiki environment
 +if (!defined("DOKU_INC")){
 +    die();
 +}
 +//delete all (defaults)
 +$_vector_btns = array();  
 +
 +//note: The buttons will be rendered in the order they were defined. Means:
 +//      first button will be rendered first, last button will be rendered at
 +//      last.
 +//DokuWiki button
 +$_vector_btns["dw"]["img"     = DOKU_TPL."static/img/button-dw.png";
 +$_vector_btns["dw"]["href"    = "https://www.dokuwiki.org/";
 +$_vector_btns["dw"]["width"   = 80;
 +$_vector_btns["dw"]["height"  = 15;
 +$_vector_btns["dw"]["title"   = "DokuWiki";
 +$_vector_btns["dw"]["nofollow"] = !(cleanID(getID()) === "start");
 +
 +//"vector for DokuWiki" button
 +$_vector_btns["vecfdw"]["img"     = DOKU_TPL."static/img/button-vector.png";
 +$_vector_btns["vecfdw"]["href"    = "https://www.dokuwiki.org/template:vector";
 +$_vector_btns["vecfdw"]["width"   = 80;
 +$_vector_btns["vecfdw"]["height"  = 15;
 +$_vector_btns["vecfdw"]["title"   = $lang["vector_mdtemplatefordw"];
 +$_vector_btns["vecfdw"]["nofollow"] = !(cleanID(getID()) === "start");
 +
 +</code>
 +====  Mobile Scaling ====
 +
 +The layout on a phone isn't too good, and can't be zoomed/scaled. 
 +
 +I found this thread:
 +
 +[[https://forum.dokuwiki.org/d/12469-vector-template-doesn-t-display-correctly-on-mobile-devices/6]]
 +
 +and applied the comment-out of the line :
 +
 +<code php>
 +
 +//echo "<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" />";
 +</code> 
 +
 +in ''main.php'' and ''mediamanager.php''
 +
 +the page now scales/zooms okay to make it useable on a phone.
 +
 +===== Monobook user/screen.css =====
 +
 +<code css>
 +/* Give sidebar more space.
 + 
 +   Default widths:
 +   - 12.2em as left spacer for the content area. This example is using 14.2em
 +     instead.
 +   - 11.6em as sidebar width. This example is using 13.6em instead.
 +   - 10.9em as width for the search input field. This example is using 12.9em
 +     instead.
 +   - 150px as left spacer for the Ajax searchbox. This example is using 180px.
 +*/
 +/* move content container more to the right */
 +#content {
 +  margin: 2.8em 0 0 14.2em;
 +}
 +#column-content {
 +  margin: 0 0 .6em -14.2em;
 +}
 +#column-content #content {
 +  margin-left: 14.2em !important; /* adjustment for  IE (7) */
 +}
 +/* redefine sidebar width + tab bar position */
 +.portlet {
 +  width: 13.6em;
 +}
 +#p-cactions {
 +  left: 13.6em; /* tab bar */
 +}
 +/* search input field */
 +#qsearch__in {
 +  width: 11.5em;
 +}
 +/* ajax "matching pagename" searchbox */
 +#qsearch__out {
 +  left: 180px
 +}
 +
 +div.dokuwiki #dw__toc {
 +  margin: 1.2em 0 0 2em;
 +  float: right;
 +  width: 200px; 
 +  font-size: 100%;
 +  clear: both;
 +  background-color: __background__;
 +
 +
 +div#content .dokuwiki code {
 +  font-size: 1.1em;
 +  padding-left: 5px;
 +  padding-right: 5px;
 +  background-color: #eee;
 +  color: #22f;
 +  border-radius: 4px;
 +  direction: ltr;
 +  text-align: left;
 +  white-space: pre;
 +}
 +
 +div#content .dokuwiki pre {
 +        border-radius: 5px;
 + background-color: #faffff !important;
 +}
 +
 +.pBody {
 + font-size: 1.1em;
 + padding-bottom: 1em;
 +}
 +
 +#bodyContent {
 + font-size: 1.1em;
 +}
 +
 +kbd.__keyboard {
 +  color: #0000ff;
 +  background-color: #defede !important;
 +  text-align: center;
 +  border-left: 1px solid #cfcfcf;
 +  border-top: 1px solid #cfcfcf;
 +  border-right: 3px solid #666666;
 +  border-bottom: 3px solid #666666;
 +  -moz-border-radius: 4px 4px 4px 4px;
 +  border-radius: 6px 6px 6px 6px !important;
 +  padding-left: 3px;
 +  padding-top: 0px;
 +  padding-right: 3px;
 +  padding-bottom: 0px;
 +  margin-left: 2px;
 +  margin-right: 2px;
 +  vertical-align: top;
 +  font-family: sans-serif;
 +  white-space: nowrap;
 +  font-size: 1.1em !important;
 +}
 +
 +div.qq-upload-button {
 + border: 1px solid __border__;
 +}
 +
 +</code>
 ===== Dokuwiki Template CSS ===== ===== Dokuwiki Template CSS =====
  
Line 236: Line 473:
 kbd.__keyboard { kbd.__keyboard {
   color: #0000ff;   color: #0000ff;
-  background-color: #defede;+  background-color: #defede !important;
   text-align: center;   text-align: center;
   border-left: 1px solid #cfcfcf;   border-left: 1px solid #cfcfcf;
Line 375: Line 612:
   * it seems necessary to disable ''showThemeSwitcher'' and to select a default theme to be used outside of any listed in the conf file   * it seems necessary to disable ''showThemeSwitcher'' and to select a default theme to be used outside of any listed in the conf file
  
-===== Vector / Monobook tweaks ===== 
- 
-I like the Vector and Monobook templates, very similar feel to Wikipedia 
- 
-==== Logout errors with later versions of Dokuwiki ==== 
- 
-After upgrading Dokuwiki to //Igor// it became impossible to log out due to a warning  
- 
-<note warning> 
-Security Token did not match. Possible CSRF attack. 
-</note> 
- 
-I initially ignored it but then downgraded back to //Hogfather// as there seemed to be no fix - other than to use a different template. 
- 
-I recently upgraded to the latest Dokuwiki (Jack Jackrum), and upgraded all plugins and templates where possible. However the problem with logout with Vector and Monobook re-appeared. 
- 
-I found there was a fix described on the forum: 
- 
-[[https://forum.dokuwiki.org/d/20248-security-token-did-not-match-possible-csrf-attack-cannot-log-out]] 
- 
-and the cure is to edit the appropriate line in ''main.php'' for each template, as the author seems not to be maintaining these templates any more, at least not the official ones accessed via Dokuwiki's Template/Extension installer. The github repository shows that the fix has been applied to ''Vector'', and a pull request submitted to fix ''Monobook'', the fixes haven't appeared in the official versions.  
- 
-The FIXME does work, though... 
- 
-For Vector edit ''/var/www/html/dokuwiki/lib/tpl/vector/main.php'' to add '', 'sectok' => getSecurityToken()'' in the ''array'' statement after ''"do" => "logout"'' 
- 
-<code php> 
- echo      <li id=\"pt-logout\"><a href=\"".wl(cleanID(getId()), array("do" => "logout", 'sectok' => getSecurityToken()))."\" rel=\"nofollow\">".hsc($lang["btn_logout"])."</a></li>\n"; //language comes from DokuWiki core 
- 
-</code> 
- 
-and the same for ''Monobook'' 
-<code php> 
- echo          <li id=\"pt-logout\"><a href=\"".wl(cleanID(getId()), array("do" => "logout", 'sectok' => getSecurityToken()))."\" rel=\"nofollow\">".hsc($lang["btn_logout"])."</a></li>\n"; //language comes from DokuWiki core 
- 
-</code> 
- 
- 
-==== Monospace font ==== 
- 
-I found the style applied to ''monospace'' text was a little underwhelming.  
- 
-I found the place to change it: 
- 
-'' /var/www/html/dokuwiki/lib/tpl/{vector|monobook}/user/screen.css '' 
- 
-add the the following and adjust as needed: 
- 
-<code css> 
- 
-div#content .dokuwiki code { 
-  font-size: 100%; 
-  padding-left: 5px; 
-  padding-right: 5px; 
-  background-color: #eee; 
-  color: #00f; 
-  direction: ltr; 
-  text-align: left; 
-} 
- 
- 
-</code> 
- 
-==== Footer Buttons ==== 
- 
-Remove the default footer buttons by editing ''{vector|monobook}/user/buttons.php'' and adding 
- 
-<note tip> 
-For Monobook, change to <code>$_monobook_btns = array();</code> 
-</note> 
- 
-<code php> 
- 
-//delete all (defaults) 
-$_vector_btns = array(); 
-</code> 
- 
-this suppresses the inclusion of footer buttons from ''vector/conf/buttons.php'' 
- 
-=== Add just the Dokuwiki and Vector/Monobook Buttons === 
- 
-Edit ''{vector|monobook}/user/buttons.php'' 
- 
-<note tip> 
-Swap ''monobook'' for ''vector'' as appropriate 
-</note> 
- 
-<code php> 
- 
-<?php 
- 
-//check if we are running within the DokuWiki environment 
-if (!defined("DOKU_INC")){ 
-    die(); 
-} 
-//delete all (defaults) 
-$_vector_btns = array();   
- 
-//note: The buttons will be rendered in the order they were defined. Means: 
-//      first button will be rendered first, last button will be rendered at 
-//      last. 
-//DokuWiki button 
-$_vector_btns["dw"]["img"     = DOKU_TPL."static/img/button-dw.png"; 
-$_vector_btns["dw"]["href"    = "https://www.dokuwiki.org/"; 
-$_vector_btns["dw"]["width"   = 80; 
-$_vector_btns["dw"]["height"  = 15; 
-$_vector_btns["dw"]["title"   = "DokuWiki"; 
-$_vector_btns["dw"]["nofollow"] = !(cleanID(getID()) === "start"); 
- 
-//"vector for DokuWiki" button 
-$_vector_btns["vecfdw"]["img"     = DOKU_TPL."static/img/button-vector.png"; 
-$_vector_btns["vecfdw"]["href"    = "https://www.dokuwiki.org/template:vector"; 
-$_vector_btns["vecfdw"]["width"   = 80; 
-$_vector_btns["vecfdw"]["height"  = 15; 
-$_vector_btns["vecfdw"]["title"   = $lang["vector_mdtemplatefordw"]; 
-$_vector_btns["vecfdw"]["nofollow"] = !(cleanID(getID()) === "start"); 
- 
-</code> 
-====  Mobile Scaling ==== 
- 
-The layout on a phone isn't too good, and can't be zoomed/scaled.  
- 
-I found this thread: 
- 
-[[https://forum.dokuwiki.org/d/12469-vector-template-doesn-t-display-correctly-on-mobile-devices/6]] 
- 
-and applied the comment-out of the line : 
- 
-<code php> 
- 
-//echo "<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" />"; 
-</code>  
- 
-in ''main.php'' and ''mediamanager.php'' 
- 
-the page now scales/zooms okay to make it useable on a phone. 
  
 ==== Alternative ==== ==== Alternative ====

Navigation