Try to learn something about everything, and everything about somethingThomas Huxley “Darwin's bulldog” (1824-1895)

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 [30/12/25 09:55 GMT] – external edit 127.0.0.1public:computers:dokuwiki_tweaks [19/04/26 16:02 BST] (current) – [Hide Revisions and Page Source for not-logged in Users] john
Line 3: Line 3:
 ====== DokuWiki Tweaks ====== ====== DokuWiki Tweaks ======
  
 +===== Hide Revisions and Page Source for not-ADMIN in Users =====
 +
 +Edit ''../lib/tpl/monobook/conf/tabs.php'' to add the check of ''AUTH_ADMIN'' for the tabs for Page Source and Revisions
 +
 +<code php>
 + 
 +            if(!empty($INFO["exists"])){
 +                $_monobook_tabs["ca-edit"]["text"] = $lang["btn_edit"]; //language comes from DokuWiki core
 +            }else{
 +                $_monobook_tabs["ca-edit"]["text"] = $lang["btn_create"]; //language comes from DokuWiki core
 +            }
 +        }
 +    }elseif (actionOK("source") && (auth_quickaclcheck($ID) == AUTH_ADMIN)){ //check if action is disabled and also that AUTH_ADMIN is logged in
 +        $_monobook_tabs["ca-edit"]["text"     = $lang["btn_source"]; //language comes from DokuWiki core
 +        $_monobook_tabs["ca-edit"]["accesskey"] = "E";
 +    }
 +
 +
 +    //old versions/revisions tab
 +    if (!empty($INFO["exists"]) &&
 +            actionOK("revisions")
 +        && (auth_quickaclcheck($ID) == AUTH_ADMIN)) // check AUTH_ADMIN is logged in to see old revisions
 +        { //check if action is disabled
 +        //ATTENTION: "ca-history" is used as css id selector!
 +        $_monobook_tabs["ca-history"]["text"     = $lang["btn_revs"]; //language comes from DokuWiki core
 +        $_monobook_tabs["ca-history"]["href"     = wl(cleanID(getId()), array("do" => "revisions"), false, "&");
 +        $_monobook_tabs["ca-history"]["accesskey"] = "O";
 +        if ($ACT === "revisions"){ //$ACT comes from DokuWiki core
 +            $_monobook_tabs["ca-history"]["class"] = "selected";
 +        }
 +
 +</code>
 +===== Include / Blog "Read More..." =====
 +
 +The default is for a "read more..." link to be placed at the extreme right of the page - which is not ideal when using Monobook template.
 +
 +I found the css setting that controls the position of "read more..." in ''../lib/plugins/include/style.css''
 +
 +<code css>
 +div.dokuwiki p.include_readmore {
 +  text-align: right;
 +}
 +</code>
 +
 +changing it to 
 +
 +<code css>
 +div.dokuwiki p.include_readmore {
 +  text-align: left;
 +}
 +</code> 
 +
 +solved the problem and "read more..." is now on the left, directly at the point that the eyes get to when reading a post on the main blog index page.
 +
 +To prevent this being overwritten on updates I found it works to put the same stanza in ''../conf/userstyle.css'' which should keep it safe...
 +
 +
 +===== 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>
 +==== Symbol Chooser font size ====
 +
 +The drop-down picker for choosing a symbol to insert in the text being edited is very small in Monobook as standard.
 +
 +It's controlled by the ''pickerbutton'' class and is set at ''80%'' in the standard ''monobook'' css.
 +
 +It's adjusted thus (to 1.2em) and some extra margin added around the symbols:
 +
 +button.pickerbutton {
 +  padding: 0px;
 +  margin: 2px 2px 2px 2px;
 +  border: 0;
 +  background-color: transparent;
 +  font-size: 1.2em;
 +  cursor: pointer;
 +}
 +
 +
 +Put this in ''user/screen.css'' with all the other tweaks.
 +
 +
 +====  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;
 +}
 +
 +button.pickerbutton {
 +  padding: 0px;
 +  margin: 2px 2px 2px 2px;
 +  border: 0;
 +  background-color: transparent;
 +  font-size: 1.2em;
 +  cursor: pointer;
 +}
 +.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 103: Line 427:
 </code> </code>
  
 +
 +===== jpg upload error - XML =====
 +
 +Media manage red warnings when uploading jpg image files
 +
 +<note warning>
 +Error: Call to undefined function xml_parser_create()
 +</note>
 +
 +New VPS was missing the '' php-xml '' package.
 +
 +  sudo apt install php-xml
 +  sudo service apache2 restart
 +  
 +
 +[[https://forum.dokuwiki.org/d/21045-error-call-to-undefined-function-xml-parser-create]]
 ===== Acronyms & Abbreviations ===== ===== Acronyms & Abbreviations =====
  
 I find the underlining and "explanation" of some abbreviations/acronyms by dokuwiki, when rendering a page, to be annoying. I find the underlining and "explanation" of some abbreviations/acronyms by dokuwiki, when rendering a page, to be annoying.
 +
 +such as DNS and ACL
  
 The process is described [[https://www.dokuwiki.org/abbreviations | HERE ]] The process is described [[https://www.dokuwiki.org/abbreviations | HERE ]]
Line 234: Line 576:
 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 373: Line 715:
   * 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 ====
Line 620: Line 826:
  
 Page Updated: ~~LASTMOD~~ Page Updated: ~~LASTMOD~~
 +
 +
  
 {{tag>dokuwiki}} {{tag>dokuwiki}}
  
  

Navigation