Description
A set of instructions for adding recipes and features that are useful for PmWiki-powered Content Management System.
Notes
When I create a new PmWiki site I nearly always install a certain few of my customized recipe scripts. I started a project to bundle those scripts together and publish them along with the instructions here.
The scripts (there were originally three) used to be on this page. Now two of them (CMS Mode and CMSMode AddLink) have their own recipe pages.
CMS Mode script
Now documented here: Cookbook.CMSMode?.
Addlink Bookmarklet script
No documented here: Cookbook.CMSBundleAddLink?.
Local configuration file
Put the two recipe file in you cookbook/ directory and add the following to the end your configuration file (config.php) to turn PmWiki 2.1.10 or newer into a nice little CMS. (Global edit password required.)
/** * Recipes */ ## Put the wiki in "CMS Mode". $pagename = ResolvePageName($pagename); include_once("$FarmD/cookbook/cmsb-cmsmode.php"); ## Enable the IP- and content-banning recipe. if ($action == 'edit' || $action == 'comment' || $action == 'diff') { include_once("$FarmD/cookbook/cmsb-blocklist.php"); } ## Enable the AddLink Bookmarklet recipe. if ($action == 'edit' || $action == 'browse' || $action == 'addlink') { include_once("$FarmD/cookbook/cmsb-addlink.php"); } ## Apply a CMS Look for non-authors (ver. 2.1.10 or newer PmWiki default skin). if (! @$page['=auth']['edit']) { $HTMLStylesFmt[CMSLook] = ' .headnav, #wikicmds, .pagegroup, .footnav { display:none } .pagetitle { margin-top:8px; } div.lastmod { color:#cccccc; } '; }
Customize the sidebar
First, let's hide Wiki-related content from non-authors. Underneath the top link, add an (:if auth edit:)
directive, as in
* [[Main/HomePage]] [<...more sidebar content...>] (:if auth edit:) * [[Main/WikiSandbox]] [<...author-only sidebar content...>]
The PmWiki-related content on the sidebar will now disappear unless you are an author.
Next, let's add a Logout link. At the bottom of the sidebar page, add a "Log out" link. When you are done, it will look like this:
[<...author-only sidebar content...>] %right% [-[[Site.SideBar?action=edit | edit SideBar]]-][[<<]] %right% [-[[Main.HomePage?action=logout | Log out]]-]
Customize the Page Actions
- Add a Login link.
- Remove the Print link.
- Add an AllRecentChanges link.
When you are an editor and want to become an administrator or an "uploader", it helps to have a link to take you to the login page. Also, I don't like the anachronistic Print link and often find a sitewide AllRecentChanges link handy. The $SiteGroup
.PageActions page gets this content:
* %item class=browse accesskey='$[ak_view]'%[[{$FullName} | $[View] ]] * %item rel=nofollow class=edit accesskey='$[ak_edit]'%[[{$FullName}?action=edit | $[Edit] ]] * %item rel=nofollow class=diff accesskey='$[ak_history]'%[[{$FullName}?action=diff | $[History] ]] (:if auth upload:) * %item rel=nofollow class=upload accesskey='$[ak_attach]'%[[{$FullName}?action=upload | $[Attach] ]] (:if:) * %item rel=nofollow class=login accesskey='$[ak_login]'%[[{$FullName}?action=login | $[Log in] ]] * %item rel=nofollow class=allrecent accesskey='$[ak_arc]'%[[{$SiteGroup}.AllRecentChanges | $[A.R.C.] ]] |
When you're done, set new edit password of " @_site_edit
" on your $SiteGroup
.PageActions page.
Customize the logo
Go to this site and create a logo. The background color is 247/247/247. A font with a slim upper margin looks best. Rename the file to something that makes sense, like site_logo.png, and put it in your pub/ directory.
Configure PmWiki to use it by adding this line to your config.php file:
$PageLogoUrl = "$PubDirUrl/site_logo.png";
You can adjust the position of the searchbox and make the "Search" link text text match the links in the sidebar with this:
$HTMLStylesFmt['site_searchbox'] = ' #wikihead { margin-top:10px; } #wikihead a { text-decoration:none; color:black; } #wikihead a:hover { text-decoration:underline; color:blue; } ';
Release Notes
- See CMSMode#release_notes? for the CMS Mode script's release notes.
- See CMSBundleAddLink#release_notes? for the Addlink Bookmarklet script's release notes.
- 20-6-09-14 - Moved AddLink script to its own recipe page.
Contributors
- NeilHerber? has donned his programmer's hat and provided helpful feedback and advice about the blocklist and addlink scripts.