PMWiki 101
Overview
PmWiki is a wiki-based content management system (CMS) for collaborative creation and maintenance of websites. PmWiki is superb for documentation.
- Authorized Content via if-ifend
- Frames
- Standard Callouts (warning,important,tip,note)
- Custom Changes: <Hn> Values
- Enabling Javascript
- MarkupTricks
- Page Variables
- Smaller Text Block
Install Apache & PHP on Linux
1. yum install httpd -y systemctl start httpd.service systemctl enable httpd.service Test http://localhost 2. yum install php -y systemctl restart httpd.service systemctl enable php.service 🠈 Newer versions may not require this. 3. Create Test File vi /var/www/html/pi.php <?php phpinfo(); ?> 4. Test http://myhostname/pi.php
Security Changes
1. Disable SELINUX if used. Otherwise you may get messages like this: PmWiki "Cannot acquire lockfile" 2. Set owner and privs. chown -R apache:apache /var/www/html chmod -R 757 /var/www/html
Install PMWiki
Download software from here.
Copy to Web Server Path
If on Client PC
• unzip pmwiki-latest.zip to D:\sw\PMWiki\pmwiki-latest\pmwiki-n.n.nn • Use FileZilla to copy ...\pmwiki-n.n.nn\* to Linux systems /var/www/html/
If on Linux Host System
• cp pmwiki-latest.zip /var/www/html/
• cd /var/www/html
• unzip pmwiki-latest.zip
/var/www/html/pmwiki-2.2.nnn created.
Rename pmwiki-2.2.nnn to your Wiki dir name:
mv /var/www/html/pmwiki-2.2.116 /var/www/html/MyWikiDir
Init Wiki
• Navigate to: http://MySiteURL/MyWikiDir/pmwiki.php Wiki should be displayed. • Make any indicated changes then refresh page to confirm OK. Example changes: mkdir /var/www/html/MyWikiDir/wiki.d chmod 777 /var/www/html/MyWikiDir/wiki.d
Common Changes
config.php Changes
Copy Template File
• cd /var/www/html/MyWikiDir/docs • cp sample-config.php /var/www/html/MyWikiDir/local/config.php
Copy Your Site Image File (if used)
• Create Logo Image.
• Copy Logo Image to /var/www/html/MyWikiDir/pub/skins/pmwiki
This is the physical dir for image file (AKA PageLogoUrl).
Edit config.php
vi /var/www/html/MyWikiDir/local/config.php
# Set Wiki Title $WikiTitle = 'MyTitle'; # Set Path to Logo Image (if used) $PageLogoUrl = "$PubDirUrl/skins/pmwiki/MyLogo.png"; # Set Links Default to Open in New Tab (add this to end of file) $UrlLinkFmt = "<a class='urllink' href='\$LinkUrl' rel='nofollow' target='_blank'>\$LinkText</a>"; # Enable CSS line-height $WikiStyleCSS[] = 'line-height'; # TimeZone (change if needed) putenv("TZ=EST5EDT"); # if you run PHP 5.0 or older date_default_timezone_set('America/New_York'); # if you run PHP 5.1 or newer
To disable link behavior for specific links use %target=_self%
in front of the link.
Set Start Page (index.ext)
Ideally copy pmwiki.php to index.php or alternatively create redirect page for index.html.
<html> <head> <meta http-equiv="refresh" content="0;url=http://MySiteURL/MyWikiDir/pmwiki.php"> </head> </html>
- Google and many other search engines do not like redirect main pages. If your wiki is for local network use then redirecting index.html is OK.
- Many cookbooks rely on pmwiki.php to exist. This is why we copy it to index.php rather than rename it.
Password Protect Site
Place at top of file: /var/www/html/MyWikiDir/local/config.php
# Custom Changes: Start ############### $DefaultPasswords['read'] = pmcrypt('MySitePW'); # Custom Changes: End ###############
Uncomment\Edit
$DefaultPasswords['admin'] = pmcrypt('MySitePW'); ... $DefaultPasswords['upload'] = pmcrypt('MySitePW');
Commonly Installed Cookbooks
- AutoTOC
- BackupHTMLZip (ensures backup files usable via Browser opening local files)
Common Settings# Create "backup" directory relative to index.php where the wiki is exported. cd /var/www/html/MyWiki mkdir backup chown apache:apache backup chmod 777 backup # config.php Changes $BHZip['pages'] = '*.*'; $BHZip['adminperms'] = true; $BHZip['squelch_hours'] = 0; $BHZip['dir'] = 'backup'; $HandleAuth['bhzip'] = 'ALWAYS';
cron entry:
00 17 * * * wget -q -O /dev/null "http://localhost/MyWiki/pmwiki.php?action=bhzip"
Example backup file in /var/www/html/MyWiki:
backup-20190719_210024.zip
- Captchas | ReCaptcha
- CodeMirror
1. DL latest version of CodeMirror (ex: codemirror-5.59.2). 2. DL Code Mirror cookbook zip file (ex: codemirror.zip). 3. In a working directory on local PC unzip each creating: • D:\temp\codemirror-5.59.2 • D:\temp\cm4pm 4. Copy entire unzipped codemirror-5.59.2 directory to /wwwroot/pub. Creating /wwwroot/pub/codemirror-5.59.2 5. Copy cm dir (D:\temp\cm4pm\pub\cm) to /wwwroot/pub. Creating /wwwroot/pub/cm 6. Copy D:\temp\cm4pm\cookbook files to /wwwroot/cookbook dir. cm-modes-compat.php, cm-sourceblock.php and codemirror.php. 7. Add corresponding entries to config.php # Codemirror Cookbook $CodeMirrorActivePresets['linewrapping'] = 0; $CodeMirrorActivePresets['autoresize'] = 1; $CodeMirrorPresetParams['search'] = 1; $CodeMirrorBaseUrl = "\$FarmPubDirUrl/codemirror-5.59.2"; include_once("$FarmD/cookbook/codemirror.php");
- CleanUp (purges deleted pages )
- Google Search: 1 | 2
- Persistent Logins
- Reindex
- Tables: Formatting | Sortable
- WikiStylesPlus
WikiStylesPlus session.
APPENDIX
Google Search
(:table :) (:cell:) (:input form action="http://www.google.com/search" method=get:) (:input text name=q value="" size=9 :)(:input submit name Search:) (:input hidden name="sitesearch" value="oracledba.help/":) (:input end:) (:tableend:)
Enable Uploads
- Create an uploads dir under wherever pmwiki.php found. Note lower case.
- Make required changes to config.php
# Uploads Cfg $DefaultPasswords['upload'] = pmcrypt('MySitePW'); $EnableUpload = 1; $UploadPermAdd = 0; $UploadPrefixFmt = ''; #Cfg for site-wide uploads $UploadMaxSize = 1000000; # Upload Max File Size: 1mb=1000000, 25mb=25000000 etc. # To find path use PHP Variable (pi.php): _SERVER["APPL_PHYSICAL_PATH"] # Ex: D:\home\oracledba.help\wwwroot\ # Then from that: #$UploadDir = "D:\home\oracledba.help\wwwroot\app\mp3\uploads"; #$UploadUrlFmt = "http://oracledba.help/mp3/uploads";
Note: Ensure your PHP installation allows uploads. The php.ini file needs file_uploads = On
.
Usage
Attach:FileName.jpg
Example: Attach:chuck.jpg
Show All Uploaded Files: (:attachlist:)
Clean Table Look
Case | Created | Topic |
---|---|---|
2376365 | 07/06/17 | This is a test. |
2344130 | 03/24/17 | This is another test. |
||border="1" style="border-collapse:collapse" cellpadding="2" width=100% ||!Case ||!Created ||!Topic || ||2376365 ||07/06/17 ||This is a test. || ||2344130 ||03/24/17 ||This is another test.||
Form Controls: ASCII and UNICODE Images
Complete chart here.
☑ ☐ ⮽ ★☆☀ 🖸 ⮾ ⮿ 🢧🢠 🠈🠊 🡆🡄 ✓✔
Form Controls: HTML
Authorized Content via if-ifend
(:if auth edit:) Content here... (:ifend:)
>>frame font-size=smaller<< frame >><<
frame
>>cframe<< cframe >><<
cframe
>>pre<< pre 1 2 3 1 2 3 1 2 3 >><<
pre
1 2 3 1 2 3 1 2 3
Standard Callouts
%target=_blank% %bgcolor=yellow% >>note fullwidth border='1px solid DarkGray' font-size=small<< >>important fullwidth border='1px solid DarkGray' font-size=small<< >>warning fullwidth border='1px solid DarkGray' font-size=small<< <warning|important|tip> border='1px solid gray'
Custom Changes: <Hn> Values
Custom HTML <Hn> changes from the base install.
- Get a color swatch for site.
Ex: https://coolors.co - Edit /var/www/html/oradocs/pub/skins/pmwiki/pmwiki.css as shown:
#h1, h2, h3, h6 { font-weight:normal; } h1 { font-size:2em; font-weight:bold; color:#0d0221;} h2 { font-size:1.5em; font-weight:bold; color:#0f084b;} h3 { font-size:1.15em; font-weight:bold; color:#26408B;} h4 { font-size:.85em; font-weight:bold; color:#a6cfd5;}
- Edit /var/www/html/oradocs/pub/skins/pmwiki/pmwiki.tmpl
Change this line: <h1 class='pagetitle'>{$Title}</h1></div> to this: <h1>{$Title}</h1></div>
Enabling Javascript
(:html:) <script language="JavaScript"> alert("Thanks to PM for that markup."); </script> (:htmlend:)
Page Variables
Define (:vPatchNumber: 29252164:) Usage: {$:vPatchNumber} Date\Time String via System\MarkupExpressions {(ftime fmt="%Y%m%d%H%M")}
202412211106
References: MarkupExpressions, strftime.
Smaller Text Block
>>frame background-color=#eeeeee border='1px' font-size=smaller padding=0px width=500<<
Ei labore minimum quaestio quo. Ut vel docendi tibique, vix in quem meis menandri, no eam labore invenire patrioque. Eu eum consul suscipiantur, mel ea soluta libris. Tollit laudem vim no. Aliquid intellegam voluptatibus ad cum, lorem populo iracundia ut mei. Salutandi facilisis necessitatibus in quo, aeque gloriatur eum an, laboramus voluptaria eu sea.
WikiStylesPlus Install Session
cd /u01/orasw/pmwiki/wsplus cp wsplus.zip /var/www/html/MyWikiDir/ cd /var/www/html/MyWikiDir unzip wsplus.zip Archive: wsplus.zip inflating: cookbook/wsplus.php creating: pub/wsplus/ inflating: pub/wsplus/tip.gif extracting: pub/wsplus/warning.gif inflating: pub/wsplus/csshover.htc inflating: pub/wsplus/wsplus.css extracting: pub/wsplus/important.gif vi /var/www/html/MyWikiDir/local/config.php include_once('cookbook/wsplus.php');
Vanilla5 Tweeks
DL Vanill5 here.
CSS Changes
pub/skins/vanilla5/css/mystyle.css
/* --- ME Custom Changes: Start --- */ p{ padding: 0 0 0 0; } hr{ border-radius: 0px; height: 6px; margin: 0px 0px 0px; border: 0; clear: both; } /* --- ME Custom Changes: End --- */
Note: View standard.css to see default then change in mystyle.css.
pub/skins/vanilla5/css/fonts.css
/* @font-face { font-family: 'Lobster'; font-style: normal; font-weight: 400; src: local('Lobster'), url(../fonts/Lobster.woff) format('woff'); } */ /* ME CUstom Change */ @font-face { font-family: 'Arial'; font-style: normal; font-weight: 400; src: local('Lobster'), url(../fonts/Lobster.woff) format('woff'); }
Testing
>>frame width=100pct<< (:linebreaks:) (:nolinebreaks:) >>white-space=pre border='1px solid gray' padding=2px << %lightgrey% >>teal pre background-color:lightgrey border:'medium dotted green'<< >>frame background-color=#eeeeee border='1px' font-size=smaller padding=0px width=500<< >>pre font-size=small line-height=125pct<< ----- >>frame background-color=#eeeeee border='1px' font-size=smaller padding=0px<< >>frame background-color=#FFFFFF font-size=smaller padding=0px margin=0px <<
Upgrade Version
To upgrade to the latest PMWiki version:
0. Backup all your files. 1. DL latest PMWiki to a working dir (ex: pmwiki-latest.zip). 2. Unzip file creating corresponding version dir (ex: pmwiki-2.2.135). 3. The following dirs will be created from the zip file: - cookbook - docs - local - pub - scripts - wikilib.d index.php pmwiki.php README.txt 4. Copy each above dir files over (overwriting) the corresponding files on destination. 5. Test!