FAQ
(:Summary: PmWiki group header. Includes styles and trail.:) (:comment please leave the multiple style definitions concatenated as a single line. Linebreaks do appear in the output when the wiki is configured with linebreaks enabled -- thanks!:) (:comment included in PmWiki localisation headers and footers :)
This page will attempt to summarize some of the more commonly asked questions. The answers are on the corresponding pages (see link). If you have a question which isn't answered here, you can leave your question on the Questions page or search for documentation using the search facility. More documentation can be found on the documentation index page.
(:comment The questions and answers are held on their respective page(s), then collated below according to the pagelist. Please make changes to those page(s) rather than making the changes here .:)
Introduction
>>faq<< >>faq<< Q: What is PmWiki? A: PmWiki is a wiki-based system for collaborative creation and maintenance of websites. See PmWiki.
Q: What can I do with it? A: PmWiki pages look and act like normal web pages, except they have an "Edit" link that makes it easy to modify existing pages and add new pages into the website, using basic editing rules. You do not need to know or use any HTML or CSS. Page editing can be left open to the public or restricted to small groups of authors. Feel free to experiment with the Text Formatting Rules in the "Wiki sandbox". The website you're currently viewing is built and maintained with PmWiki.
Q: What are the requirements? A: See the PmWiki requirements page.
Q: Where can I find documentation? A: See the documentation index page.
Q: How can I download PmWiki? A: See the download page.
Q: How do I install PmWiki? A: Instructions for installation are on the installation page.
Q: How do I get help with PmWiki? A: See Mailing lists and How to get assistance.
Q: How do you pronounce "Michaud"? A: "Michaud" is french pronounced "mee show", the trailing D is silent. >><<
Basic PmWiki editing rules
>>faq<< >>faq<< Q: I'm new to PmWiki, where can I find some basic help for getting started? A: The Basic Editing page is a good start. From there, you can just follow the navigational links at the top or the bottom of the page (they are called Wiki Trails) to the next pages, or to the Documentation Index page, which provides an outline style index of essential documentation pages, organized from basic to advanced.
Q: How do I include special characters such as Copyright (©) and Trademark (® or ™) on my wiki pages? A: See special characters on how to insert special characters that don't appear on your keyboard.
Q: How can I preserve line-breaks from the source text?
A: PmWiki normally treats consecutive lines of text as being a paragraph, and merges and wraps lines together on output. This is consistent with most other wiki packages. An author can use the (:linebreaks:)
directive to cause the following lines of markup text in the page to be kept as separate lines in the output. Or a wiki administrator can set in ''config.php'' @@$HTMLPNewline
= '<br/>';@@ to force literal new lines for the whole site.
Q: Can I just enter HTML directly? A: By default (and by design), PmWiki does not support the use of HTML elements in the editable markup for wiki pages. There are a number of reasons for this described in the PmWiki Philosophy and Audiences. Enabling HTML markup within wiki pages in a collaborative environment may exclude some potential authors from being able to edit pages, and pose a number of display and security issues. However, a site administrator can use the Cookbook:Enable HTML recipe to enable the use of HTML markup directly in pages.
Q: Where can I find more documentation? A: See the documentation index and the markup master index pages. >><<
Creating New Pages
>>faq<< >>faq<< Q: How do I create a new page? A: Typing [[my new page]] will create a link to the new page. There's a lot you can do with double bracket links.
Q: Why do some new pages have a title with spaces like "Creating New Pages" and others end up with a WikiWord-like title like "CreatingNewPages"?
A: The default page title is simply the name of page, which is normally stored as "CreatingNewPages." However, you can override a page's title by using the (:title Creating New Pages:)
directive. This is especially useful when there are special characters or capitalization that you want in the title that cannot be used in the page name.
>><<
Links
>>faq<< >>faq<<
Q: How do I create a link that will open as a new window?
A: Use the %newwin%
wikistyle, as in:
%newwin% http://example.com/ %% |
Q: How do I create a link that will open a new window, and configure that new window?
A: This requires javascript. See Cookbook:PopupWindow.
Q: How do I place a mailing address in a page?
A: Use the mailto:
markup, as in one of the following:
* mailto:myaddress@example.com * [[mailto:myaddress@example.com]] * [[mailto:myaddress@example.com | email me]] * [[mailto:myaddress@example.com?subject=Some subject | email me]] | * myaddress@example.com * mailto:myaddress@example.com * email me * email me |
See also Cookbook:DeObMail for information on protecting email addresses from spammers.
Q: How can I enable links to other protocols, such as nntp:, ssh:, xmpp:, etc?
A: See Cookbook:Add Url schemes
Q: How do I make a WikiWord link to an external page instead of a WikiPage?
A: Use link markup. There are two formats:
->
[[http://example.com/ | WikiWord]] [[WikiWord -> http://example.com/]]
Q: How do I find all of the pages that link to another page (i.e., backlinks)?
A: In the wiki search form, use @@link=Group.Page@@ to find all pages linking to Group.Page.
A: Use the link=
option of the (:pagelist:)
directive, as in
->
(:pagelist link=SomePage list=all:) -- show all links to SomePage (:pagelist link={$FullName} list=all:) -- show all links to the current page
Note that (with a few exceptions) includes, conditionals, pagelists, searchresults, wikitrails, and redirects are not evaluated for Wikilinks, and so any links they put on the page will not be found as backlinks. All other directives and markup, for example links brought to the page by (:pmform:), will be found.
Q: What link schemes does PmWiki support? A: See PmWiki:Link schemes
Q: How do I open external links in a new window or mark them with an icon? A: See Cookbook:External links
Q: How can I use an image as a link? A: Use [[Page| Attach:image.jpg ]] or [[ http://site | http://site/image.jpg ]] See Images#links
Q: Why my browser does not follow local file:// links? A: For security reasons, most browsers will only enable file:// links if the page containing the link is itself on the local drive. In other words, most browsers do not allow links to file:// from pages that were fetched using http:// such as in a PmWiki site. See also Cookbook:DirList for a workaround. >><<
Images
>>faq<< >>faq<<
Q: Is it possible to link an image on PmWiki without using a fully qualified URL?
A: Yes. For images that are attachments, the general format is Attach:Groupname./image.gif
. To link to an image that is on the same server, use Path:/path/to/image.gif
.
Q: Can I attach a client image file on PmWiki? A: Yes, see Uploads .
Q: How can I include a page from another group that contains an attached image?
A: Include the page in the normal way, ie (:include GroupName.Pagename:)
. In the page to be included (that contains the image) change Attach:filename.ext
to Attach:{$Group}./filename.ext
.
Q: Why, if I put an image with rframe or rfloat and immediatly after that I open a new page section with ! the section title row is below the image instead of on the left side? A: Because the CSS for '''headings''' such as ! contains an element '''clear:both''' which forces this behaviour. Redefine the CSS locally if you want to stop this happening, but I think the bottom border (that underlines the heading) would need further re-definition. I just use bolding for the title, and 4 dashes below ---- to separate a new section, and it saves the effort of fiddling with the core definitions.
Unlike the '''lframe''' and '''rframe''' directives, '''cframe''' does not fully honour the width setting. While the frame itself resizes to match the request, the enclosed image does not, and retains its original width. Effect is the same in IE and Fx. I've added an example beneath the standard example above.
Q: Is it possible to disallow all images? I already disabled uploads but I also want to disallow external images from being shown on my wiki pages.
A: Yes, add to config.php: ->
DisableMarkup('img'); $ImgExtPattern = "$^";
Q: How can I make it so that when I place an image in a page, the block of text it is in is a <p> (paragraph) rather than a <div> (division)?
A: If you just want it to happen for a single image (instead of all), then
try putting [==]
at the beginning of the line, as in:
->[==] http://www.pmwiki.org/pub/pmwiki/pmwiki-32.gif
Having [==]
at the beginning of a line forces whatever follows to
be part of a paragraph.
Q: Is there any way to use relative paths for images?
A: See Cookbook:RelativeLinks and $EnableLinkPageRelative
.
Q: Is there a way to attach a BMP and have it display rather than link?
A: Add to config.php the following line:
@@$ImgExtPattern = "\\.(?:gif|jpg|jpeg|png|bmp|GIF|JPG|JPEG|PNG|BMP)";@@
Note that BMP images are uncompressed and quite heavy. You may wish to convert them to PNG (lossless) or JPG (lossy) format, and thus reduce 5-20 times their filesizes.
Q: Is there a way to have a table to the left or right of an image? A: Yes, see TableAndImage. >><<
Uploads
>>faq<< >>faq<<
Q: When I upload a file, how do I make the link look like "file.doc" instead of "Attach:file.doc"?
A: Use parentheses, as in [[(Attach:)file.doc]]
. There is also a configuration change that can eliminate the Attach:
-- see Cookbook:AttachLinks.
Q: Why can't I upload files of size more than 50kB to my newly installed PmWiki?
A: Out of the box PmWiki limits the size of files to be uploaded to 50kB. Add
->@@$UploadMaxSize
= 1000000; # limit upload file size to 1 megabyte@@
->to your ''config.php'' to increase limit to 1MB (for example). See UploadsAdmin for how to further customize limits. Note that both PHP and webservers also place their own limits on the size of uploaded files.
Q: Why does my upload exit unexpectedly with "Incomplete file received"? A: You may be running out of space in a 'scratch' area, used either by PmWiki or by PHP. On *nix, check that you have sufficient free space in /tmp and /var/tmp.
Q: How do I make it so that the upload link still allows one to make another upload (if someone wants to replace the old version of a file with a newer version, for example). Currently you only get the upload link when there is no file in the upload directory. A: Use the Attach page action, and click on the delta symbol (Δ) shown against each of files listed. If you can't see the attach action either uploads are not enabled, you are not authorized to upload, or the attach action has been commented out or is missing. See also available actions.
Q: How do I hide the "Attach:" for all attachments
A: See Cookbook:AttachLinks, note that this does not currently work for [[Attach:my file.ext]]
.
Q: How can I link a file that have a 4-letter file extension such like 'abc.pptx'? A: See Cookbook:Upload Types
Q: How can I prevent others from using the url's of my images on their site A: See Cookbook:Prevent Hotlinking
>><<
Tables
>>faq<< >>faq<< Q: How do I create a basic table? A: Tables are created via use of the double pipe character: @@||@@. Lines beginning with this markup denote rows in a table; within such lines the double-pipe is used to delimit cells. In the examples below a border is added for illustration (the default is no border).
|| border=1 rules=rows frame=hsides || cell 1 || cell 2 || cell 3 || || cell 1 || cell 2 || cell 3 || |
|
Q: How do I create cell headers? A: Header cells can be created by placing ! as the first character of a cell. Note that these are ''table headers'', not ''headings'', so it doesn't extend to !!, !!!, etc.
|| border=1 rules=cols frame=vsides ||! cell 1 ||! cell 2 ||! cell 3 || || cell 1 || cell 2 || cell 3 || |
|
Q: How do I obtain a table with thin lines and more distance to the content? A: "Thin lines" is tricky and browser dependent, but the following works for Firefox and IE (Nov. 2009):
||border="1" style="border-collapse:collapse" cellpadding="5" width=66% ||!Header ||! Header || '''Header'''|| ||cells || with || padding|| || || || || |
|
Q: How do I create an advanced table? A: See table directives
Q: My tables are by default centered. When I try to use '||align=left' they don't align left as expected. A: Use ||style="margin-left:0px;" instead.
Q: How can I specify the width of columns?
A: You can define the widths via custom styles, see Cookbook:FormattingTables and $TableCellAttrFmt
. Add in config.php :
$TableCellAttrFmt = 'class=col$TableCellCount';
-> And add in pub/css/local.css :
table.column td.col1 { width: 120px; } table.column td.col3 { width: 40px; }
Q: How can I display a double pipe "||" in cell text using basic table markup?
A: Escape it with [=||=]
to display || unchanged.
Q: How to I apply styles to the elements of the table, like an ID to the table row, or a class/style to the TD? A: See $WikiStyleApply. >><<
Table directives
>>faq<< >>faq<<
Q: Can I define table headers using the table directive markup?
A: Yes, use (:head:)
or (:headnr:)
with PmWiki version 2.2.11 or newer. See also Cookbook:AdvancedTableDirectives.
Q: Is it possible to do nested tables? A: Yes, if you nest simple tables inside advanced tables. See also Cookbook:AdvancedTableDirectives.
Q: Is it possible to add background images to tables and table cells? A: Yes, see Cookbook:BackgroundImages.
Q: Is it possible to apply styles to the elements of the table, like an ID to the table row, or a class/style to the TD? A: Yes, see $WikiStyleApply.
Q: Is it possible to automatically generate columns or rows in tables, i.e. without having to do a lot of counting? A: Yes, this is possible with the Cookbook:CreateColumns recipe - it allows you to specify a certain number of columns, and/or to specify a certain number of items per column. Plus, someone has provided some similar markup on the TableDirectives-Talk page. >><<
AccessKeys
>>faq<< >>faq<<
Q: How can I change the keyboard shortcuts for editing and saving a page? A: See Customizing access keys.
>><<
PageDirectives
>>faq<<
>>faq<<
Q: Can I get (:redirect:)
to return a "moved permanently" (HTTP 301) status code?
A: Use (:redirect PageName status=301:)
.
Q: Is there any way to prevent the "redirected from" message from showing at the top of the target page when I use (:redirect:)
?
A: From version 2.2.1 on, set in config.php @@$EnableRedirectQuiet
=1;@@ and in the page @@(:redirect OtherPage quiet=1:)@@ for a quiet redirect.
Q: Is there any method for redirecting to the equivalent page in a different group, i.e. from BadGroup/thispage => GoodGroup/thispage using similar markup to (:redirect Goodgroup.{Name}:)? A: ->(:redirect Goodgroup.{$Name}:) works if you want to put it in one page.
->If you want it to work for the entire group, put (:redirect Goodgroup.{*$Name}:) into Badgroup.GroupHeader - however, that only works with pages that really exist in Goodgroup; if you visit a page in Badgroup without a corresponding page of the same name in Goodgroup, instead of being redirected to a nonexistant page, you get the redirect Directive at the top of the page.
->With (:if exists Goodgroup.{*$Name}:)(:redirect Goodgroup.{*$Name}:)(:ifend:) in Badgroup.GroupHeader you get redirected to Goodgroup.Name if it exists, otherwise you get Badgroup.Name without the bit of code displayed.
Q: How can a wiki enable linebreaks by default, i.e. without having the directive (:linebreaks:)
in a page or in a GroupHeader?
A: Add to config.php such a line:
@@$HTMLPNewline
= '<br/>';@@
>><<
IncludeOtherPages
>>faq<< >>faq<<
Q: What's the maximum number of includes that can exist in a page?
-> My site seems to stop including after 48 includes. ($MaxIncludes
)
A: By default, PmWiki places a limit of 50 include directives for any given page, to prevent runaway infinite loops and other situations that might eat up server resources. (Two of these are GroupHeader and GroupFooter.) The limit can be modified by the wiki administrator via the $MaxIncludes
variable.
Q: Is there any way to include from a group of pages without specifying by exact name, e.g. between Anchor X and Y from all pages named IFClass-* ? A: This can be achieved using page lists.
Q: There appears to be a viewing issue when the included page contains the (:title:) directive.
A: In a default installation, the ''last'' title in the page overrides previous ones so you can place your (:title :) directive at the bottom of the page, after any includes. See also $EnablePageTitlePriority
.
>><<
InterMap
>>faq<< >>faq<<
Q: Are InterMap names case sensitive?
A: Yes, thus eAdmin:
is a different InterMap link than EAdmin:
.
Q: How can I achieve a ''localmap.txt'' mapping with the effect of Pics: Path:/somepathto/pics/
?
A: Use the following:
->Pics: /somepathto/pics/
Q: How can I define an InterMap in PHP? A: Use the following: ->
$LinkFunctions['PmWikiHome:'] = 'LinkIMap'; $IMap['PmWikiHome:'] = 'http://pmwiki.org/wiki/$1';>><<
Page specific variables
>>faq<< >>faq<<
Q:Is there a variable like $LastModified, but which shows me the creation time? A:No, but you can create one in config.php. For instance: ->
# add page variable {$PageCreationDate} in format yyyy-mm-dd $FmtPV['$PageCreationDate'] = 'strftime("%Y-%m-%d", $page["ctime"])';
If you like the same format that you define in config.php with $TimeFmt
use
$FmtPV['$Created'] = "strftime(\$GLOBALS['TimeFmt'], \$page['ctime'])";
Q: How can I test if a variable is set and/or not empty? A: Use @@ (:if ! equal "{$Variable}" "":) $Variable is not empty. (:ifend:)@@. Note that undefined/inexistent variables appear as empty ones.
Categories: PmWiki Developer >><<
WikiGroup
>>faq<< >>faq<< Q: How can I get rid of the 'Main' group in urls for pages pointing to Main?
A: See Cookbook:Get Rid Of Main.
Q: How can I limit the creation of new groups?
A: See Cookbook:Limit Wiki Groups.
Q: Why doesn't [[St. Giles and St. James]] work as a link? (It doesn't display anything.)
A: Because it contains periods, and destroys PmWiki's file structure, which saves pages as Group.PageName. Adding those periods disrupts this format. Links may only contain words. If you need a link precisely as shown, the page must be named eg StGilesAndStJames then you can use the (:title:) directive to have the page's title appear with periods (:title St. Giles and St. James:). (Although in US grammar the period is often omitted and in UK grammar the period must be omitted for contractions like St).
Q: How can I delete a wiki group?
A: Normally you can't, as this requires an admin with server-side access to delete the file that makes up the group's RecentChanges page. But there is an option method of making it possible to delete RecentChanges pages from within the wiki if the admin enables the code found on Cookbook:RecentChanges Deletion.
Q: How can I delete a wiki group's Group.RecentChanges page?
A: Normally you can't, as this requires an admin with server-side access to delete a file. But there is an optional method of making it possible to delete RecentChanges pages from within the wiki if the admin enables the code found on Cookbook:RecentChanges Deletion.
Q: Can I delete a wiki group inside wiki.d folder on the server to eliminate the group? A: Yes, if you delete all files named YourGroup.*, the pages from that group will be removed from the wiki. Note that the documentation (group PmWiki) and the site configuration (groups Site and SiteAdmin) that exist in the default installation, are located in wikilib.d and not in wiki.d, and some recipes provide files located in a wikilib.d subdirectory in the cookbook directory. (You shouldn't delete the groups Site and SiteAdmin, required for normal function.)
Q: How can I list all pages in a WikiGroup?
A: In a wiki page use (:pagelist group=GroupName list=all:)
or in a search box type @@GroupName/ list=all@@.
>><<
GroupHeaders and GroupFooters
>>faq<< >>faq<<
Q: How do I set the same header or footer for all pages/groups?
A: The header and footer for each page are controlled by the variables $GroupHeaderFmt
and $GroupFooterFmt
. If your site-wide header and footer pages are Site.SiteHeader and Site.SiteFooter, you can add this in config.php:
->
### If you use Site.SiteHeader and Group.GroupHeader $GroupHeaderFmt = '(:include {$SiteGroup}.SiteHeader' . ' basepage={*$FullName}:)(:nl:)' . $GroupHeaderFmt; <:vspace> ### If you use Site.SiteHeader instead of Group.GroupHeader $GroupHeaderFmt = '(:include {$SiteGroup}.SiteHeader' . ' basepage={*$FullName}:)(:nl:)'; <:vspace> ### If you use Site.SiteFooter and Group.GroupFooter $GroupFooterFmt .= '(:nl:)(:include {$SiteGroup}.SiteFooter' . ' basepage={*$FullName}:)'; <:vspace> ### If you use Site.SiteFooter instead of Group.GroupFooter $GroupFooterFmt = '(:nl:)(:include {$SiteGroup}.SiteFooter' . ' basepage={*$FullName}:)';
Note that single quotes must be used in the lines above.
See also the Cookbook:AllGroupHeader recipe.
A: Instead of using an additional page, you could set any wiki text in $GroupHeaderFmt
, for example:
->$GroupHeaderFmt .= "Global message here.";
>><<
WikiTrails
>>faq<< >>faq<< Q: What's the difference between a PageList and a WikiTrail? A: The pagelist directive dynamically generates a list of pages. There are many ways to generate the list, including using a WikiTrail as the source. The pagelist directive then displays the pages that match the criteria using an optional template - for example displaying each page name on a separate line as a link or including the entire content. The pagelist directive currently does not have built-in navigation markup that you can put on the pages in the list. By contrast, WikiTrails are simply specified via links on an "index" page and you ''can'' put previous-next navigation markup on each page. The two serve very different purposes. WikiTrails are useful for specifying the pages in web feeds, for creating a "tour" through a predefined set of pages, and many other things. >><<
PageHistory
>>faq<< >>faq<<
Q: Is there a way to remove page history from page files? A: 1. Administrators can clean page histories using the Cookbook:ExpireDiff recipe.
A: 2. Administrators with FTP file access can download individual pages from the wiki.d directory, open them in a text editor, manually remove history, and re-upload the files to wiki.d/ directory. Care must be exercised, when manually editing a page file, to preserve the minimum required elements of the page and avoid corrupting its contents. See PageFileFormat#creating.
A: 3. Edit the page. Select ''all'' the contents of the edit text area and cut them to the clipboard. Enter @@delete@@ into the text area and click on the ''save and edit'' button. Select ''all'' the contents of the edit text area and paste the contents of the clipboard over them. Click on the ''save'' button. This will remove all of the page's history up to the final save in which the pasted material is re-added.
Q: How can I restrict viewing the page history (?action=diff)
to people with edit permission?
A: In the ''local/config.php'' file, set
->$HandleAuth['diff'] = 'edit'
;
In case of this restriction is set up on a farm, and you want to allow it on a particular wiki, set in your local/config.php :
->$HandleAuth['diff'] = 'read'
;
>><<
Passwords
>>faq<< >>faq<<
Q: How can I password protect all the pages and groups on my site? Do I really have to set passwords page by page, or group by group?
A: Administrators can set passwords for the entire site by editing the config.php file; they don't have to set passwords for each page or group. For example, to set the entire site to be editable only by those who know an "edit" password, an administrator can add a line like the following to local/config.php:
$DefaultPasswords
['edit'] = crypt('edit_password');
For more information about the password options that are available only to administrators, see PasswordsAdmin.
Q: I get http error 500 "Internal Server Error" when I try to log in. What's wrong?
A: This can happen if the encrypted passwords are not created on the web server that hosts the PmWiki.
The crypt function changed during the PHP development, e.g. a password encrypted with PHP 5.2 can not be decrypted in PHP 5.1, but PHP 5.2 can decrypt passwords created by PHP 5.1.
This situation normally happens if you prepare everything on your local machine with the latest PHP version and you upload the passwords to a webserver which is running an older version.
The same error occurs when you add encrypted passwords to local/config.php.
Solution: Create the passwords on the system with the oldest PHP version and use them on all other systems.
Q: How can I create private groups for users, so that each user can edit pages in their group, but no one else (other than the admin) can?
A: Modify the edit attribute for each group to id:username, e.g. set the edit attribute in JaneDoe.GroupAttributes to id:JaneDoe.
There is a more automatic solution, but it's probably not a good idea for most wikis. Administrators can use the AuthUser recipe and add the following few lines to their local/config.php file to set this up:
$group = FmtPageName('$Group', $pagename);
$DefaultPasswords
['edit'] = 'id:'.$group;
include_once("$FarmD
/scripts/authuser.php");
This automatically gives edit rights to a group to every user who has the same user name as the group name. Unfortunately it also gives edit rights to such a user who is visiting a same-named group not just for pages in that group, but for any page on the wiki that relies on the site's default edit password. This can create security holes.
Q: How come when I switch to another wiki within a farm, I keep my same authorization?
A: PmWiki uses PHP sessions to keep track of authentication/authorization information, and by default PHP sets things up such that all interactions with the same server are considered part of the same session.
An easy way to fix this is to make sure each wiki is using a different cookie name for its session identifier. Near the top of one of the wiki's local/config.php files, before calling authuser or any other recipes, add a line like:
session_name('XYZSESSID');
You can pick any alphanumeric name for XYZSESSID; for example, for the cs559-1 wiki you might choose
session_name('CS559SESSID');
This will keep the two wikis' sessions independent of each other.
Q: Is it possible to test the password level for display and/or if condition? Example: * (:if WriterPassword:) (display Edit link) (:ifend:)
A: You can use (:if auth edit:)
. See ConditionalMarkup.
>><<
DeletingPages
>>faq<< >>faq<<
Q: How is a Wiki Group deleted? A: An admin can remove the group pages from @@wiki.d/@@. Note that a wiki page may also have related uploads.
A: Fully deleting a group via the wiki isn't possible, since a delete counts as an "update" which causes the Recent Changes? page to be re-created. It is possible to modify the site's configuration to allow deletion of the group's RecentChanges page -- see Cookbook:RecentChangesDeletion.
Q: How is a Category deleted?
A: To delete a category, delete all the [[!Category]]
references from all pages where they occur, then delete the category page as explained above.
maintenance >><<
PmWiki Installation
>>faq<< >>faq<< Q: Should I rename pmwiki.php to index.php? A: Renaming pmwiki.php is not recommended. Instead, create an ''index.php'' file that contains this single line
-><?php include_once('pmwiki.php');
Q: How do I make pmwiki.php the default page for a website? A: Create an ''index.php'' file that runs PmWiki from a subdirectory (''pmwiki/'' for example) and place it in the site's web document root (the main directory for the website).
-><?php chdir('pmwiki'); include_once('pmwiki.php');
Note: You will also need to explicitly set the $PubDirUrl
variable (e.g. to "http://example.com/pmwiki/pub"
) in ''local/config.php'' .
Q: How do I enable "Clean URLs" that are shorter and look like paths to my wiki pages? Why does pmwiki.org appear to have a directory structure rather than "?n=pagename" in URLs? A: See Cookbook:CleanUrls.
Q: How can I run PmWiki on a standalone (offline, portable) machine ? A: See Cookbook:Standalone or Cookbook:WikiOnAStick. >><<
Upgrades
>>faq<< >>faq<<
FAQ
Q: How can I determine what version of PmWiki I'm running now? A: See version - Determining and displaying the current version of PmWiki (pmwiki-2.2.62).
Q: How can I test a new version of PmWiki on my wiki without changing the prior version used by visitors? A: The easy way to do this is to install the new version in a separate directory, and for the new version set (in local/config.php):
<:vspace> $WikiLibDirs = array(&$WikiDir, new PageStore('/path/to/existing/wiki.d/{$FullName}'), new PageStore('wikilib.d/{$FullName}')); <:vspace>This lets you test the new version using existing page content without impacting the existing site or risking modification of the pages. (Of course, any recipes or local customizations have to be installed in the new version as well.)
Then, once you're comfortable that the new version seems to work as well as the old, it's safe to upgrade the old version (and one knows of any configuration or page changes that need to be made). >><<
Uploads Administration
>>faq<< >>faq<<
Q: How do I disable uploading of a certain type of file? A: Here's an example of what to add to your ''local/config.php'' file to disable uploading of .zip files, or of files with no extension:
->
$UploadExtSize['zip'] = 0; # Disallow uploading .zip files $UploadExtSize[''] = 0; # Disallow files with no extension
Q: How do I attach uploads to individual pages or the entire site, instead of organizing them by wiki group?
A: Use the $UploadPrefixFmt
variable (see also the Cookbook:UploadGroups recipe).
->$UploadPrefixFmt = '/$FullName'; # per-page, in Group.Name directories
->$UploadPrefixFmt = '/$Group/$Name'; # per-page, in Group directories with Name subdirectories
->$UploadPrefixFmt = ''; # site-wide
Q:For $UploadDirQuota
- can you provide some units and numbers? Is the specification in bytes or bits? What is the number for 100K? 1 Meg? 1 Gig? 1 Terabyte?
A: Units are in bytes.
$UploadDirQuota
= 100*1024; # limit uploads to 100KiB
$UploadDirQuota
= 1000*1024; # limit uploads to 1000KiB
$UploadDirQuota
= 1024*1024; # limit uploads to 1MiB
$UploadDirQuota
= 25*1024*1024; # limit uploads to 25MiB
$UploadDirQuota
= 2*1024*1024*1024; # limit uploads to 2GiB
Q: Is there a way to allow file names with Unicode or additional characters?
A: Yes, see $UploadNameChars
Q:Where is the list of attachments stored? A: It is generated on the fly by the (:attachlist:) markup.
>><<
Security
>>faq<< >>faq<<
Q: How do I report a possible security vulnerability of PmWiki?
A: Pm wrote about this in a post to pmwiki-users from September 2006. In a nutshell he differentiates two cases: ## The possible vulnerability isn't already known publicly: In this case please contact us by private mail. ## The possible vulnerability is already known publicly: In this case feel free to discuss the vulnerability in public (e.g. on pmwiki-users or in the PITS). See his post mentioned above for details and rationals.
Q: What about the botnet security advisory at http://isc.sans.org/diary.php?storyid=1672?
A: Sites that are running with PHP's ''register_globals'' setting set to "On" and versions of PmWiki prior to 2.1.21 may be vulnerable to a botnet exploit that is taking advantage of a bug in PHP. The vulnerability can be closed by turning ''register_globals'' off, upgrading to PmWiki 2.1.21 or later, or upgrading to PHP versions 4.4.3 or 5.1.4. <<In? addition, there is a test at PmWiki:SiteAnalyzer that can be used to determine if your site is vulnerable.
Wiki Vandalism and Spam
:Assumptions: you are using a Blocklist and Url approvals. : :You don't want to resort to password protecting the entire wiki, that's not the point after all. : :Ideally these protections will be invoked in @@config.php@@
Q: How do I stop pages being deleted, eg password protect a page from deletion?
A: Use Cookbook:DeleteAction and password protect the page deletion action by adding $DefaultPasswords['delete'] = '*';
to @@config.php@@ or password protect the action with @@$HandleAuth
['delete'] = 'edit';@@
->or @@$HandleAuth
['delete'] = 'admin';@@ to require the edit or admin password respectively.
Q: How do I stop pages being replaced with an empty (all spaces) page?
A: Add block: /^\s*$/
to your blocklist.
Q: how do I stop pages being completely replaced by an inane comment such as ''excellent site'', ''great information'', where the content cannot be blocked? A: Try using the newer automatic blocklists that pull information and IP addresses about known wiki defacers.
A: (OR) Try using Cookbook:Captchas or Cookbook:Captcha (note these are different).
A: (OR) Set an edit password, but make it publicly available on the Site.AuthForm template.
Q: How do I password protect the creation of new groups? A: See Cookbook:Limit Wiki Groups
Q: How do I password protect the creation of new pages? A: See Cookbook:Limit new pages in Wiki Groups
Q: How do I take a whitelist approach where users from known or trusted IP addresses can edit, and others require a password? A: Put these lines to local/config.php:
## Allow passwordless editing from own turf, pass for others. if ($action=='edit' && !preg_match("/^90\\.68\\./", $_SERVER['REMOTE_ADDR']) ) { $DefaultPasswords['edit'] = crypt('foobar'); }Replace 90.68. with the preferred network prefix and foobar with the default password for others.
For a single IP, you may use
if($_SERVER['REMOTE_ADDR'] == '127.0.0.1') { # your IP address here $_POST['authpw'] = 'xxx'; # the admin password }
Please note the security issues : this means that you have your admin passwords in clear in config.php and someone with access to the filesystem can read them (for example a technician of your hosting provider) ; your IP address may change from time to time (unless you have a fixed IP contract with your ISP). When that happens, someone with your old IP address will be logged in automatically as admin on your wiki. It is extremely unlikely to become a problem, but you should know it is possible ; if you are behind a router, all other devices which pass through that router will have the same IP address for PmWiki - your wifi phone, your wife's netbook, a neighbour using your wifi connection, etc. All these people become admins of your wiki. Again, you should evaluate if this is a security risk ; In some cases, your ISP will route your traffic through the same proxy as other people. In such a case, thousands of people may have the same IP address.
A: See also Cookbook:AuthDNS & Cookbook:PersistentLogin
Q: How do I password protect page actions?
A: See Passwords for setting in config.php
-> @@$HandleAuth
['''pageactionname'''] = 'pageactionname'; # along with :@@
-> @@$DefaultPasswords
['''pageactionname'''] = crypt('secret phrase');@@
A: or
-> @@$HandleAuth
['''pageactionname'''] = 'anotherpageactionname';@@
Q: How do I moderate all postings?
A: Enable PmWiki.Drafts
* Set $EnableDrafts
, this relabels the "Save" button to "Publish" and a "Save draft" button appears.
* Set $EnablePublishAttr
, this adds a new "publish" authorization level to distinguish editing from publishing.
Q: How do I make a read only wiki? A: In config.php set an "edit" password.
Q: How do I restrict access to uploaded attachments? A: See * instructions for denying public access to the uploads directory * see Cookbook:Secure attachments
Q: How do I hide the IP addresses in the "diff" pages? A: If the user fills an author name, the IP address is not displayed. To require an author name, set in config.php such a line:
$EnablePostAuthorRequired
= 1;
A: The IP address can also be seen in a tooltip title when the mouse cursor is over the author name. To disable the tooltip, set in config.php:
$DiffStartFmt = "<div class='diffbox'><div class='difftime'><a name='diff\$DiffGMT' href='#diff\$DiffGMT'>\$DiffTime</a> \$[by] <span class='diffauthor'>\$DiffAuthor</span> - \$DiffChangeSum</div>";
Q: How do I stop some Apache installations executing a file which has ".php", ".pl" or ".cgi" anywhere in the filename
A: Use $UploadBlacklist
Q: How do I stop random people from viewing the ?action=source (wiki markup) of my pages? I have (:if auth edit:)
text that I don't want the world to see.
A: $HandleAuth['source'] = 'edit';
or $HandleAuth['source'] = 'admin';
>><<
CustomMarkup
>>faq<<
>>faq<<
Q: How can I embed JavaScript into a page's output?
A: There are several ways to do this. The Cookbook:JavaScript recipe describes a simple means for embedding static JavaScript into web pages using custom markup. For editing JavaScript directly in wiki pages (which can pose various security risks), see the JavaScript-Editable recipe. For JavaScript that is to appear in headers or footers of pages, the skin template can be modified directly, or <script> statements can be inserted using the $HTMLHeaderFmt
array.
Q: How would I create a markup (''(:nodiscussion:)'') that will set a page variable (''{$HideDiscussion}'') which can be used by ''(:if enabled HideDiscussion:)'' in .PageActions? A: Add the following section of code to your config.php ->
SDV($HideDiscussion, 0); #define var name Markup('hideDiscussion', '<{$var}', '/\\(:nodiscussion:\\)/e', 'setHideDiscussion(true)'); function setHideDiscussion($val) { global $HideDiscussion; $HideDiscussion = $val; }
This will enable the @@(:if enabled HideDiscussion:)@@ markup to be used. If you want to print the current value of {$HideDiscussion} (for testing purposes) on the page, you'll also need to add the line:
@@$FmtPV['$HideDiscussion'] = '$GLOBALS["HideDiscussion"]';@@
Q: It appears that (.*?) does not match newlines in these functions, making the above example inoperable if the text to be wrappen in <em> contains new lines. A: If you include the "s" modifier on the regular expression then the dot (.) will match newlines. Thus your regular expression will be "/STUFF(.*?)/s". That s at the very end is what you are looking for. If you start getting into multi-line regexes you may be forced to look at the m option as well - let's anchors (^ and $) match not begin/end of strings but also begin/end of lines (i.e., right before/after a newline).
Q: How can the text returned by my markup function be re-processed by the markup engine? A: If the result of your markup contains more markup that should be processed, you have two options. First is to select a "when" argument that is processed earlier than the markup in your result. For example, if your markup may return [[links]], your "when" argument could be @@"<links"@@ and your markup will be processed before the links markup. The second option is to call the PRR() function in your markup definition or inside your markup function. In this case, after your markup is processed, PmWiki will restart all markups from the beginning.
Q: How do I get started writing recipes and creating my own custom markup? A: (alternate) Introduction to custom markup for Beginners
Q: How do I make a rule that runs once at the end of all other rule processing? A: Use this statement instead of the usual @@Markup()@@ call: -->@@$MarkupFrameBase['posteval']['myfooter'] = "\$out = onetimerule(\$out);";@@ >><<
Internationalizations
>>faq<< >>faq<<
Q: If my wiki is internationalized by ''config.php'', how do I revert a specific group to English?
A: Use $XLLangs = array('en');
in the group's group customization file.
Q: If my wiki is in English and I want just one page, or group, in Spanish do I say XLPage('es','PmWikiEs.XLPage');
in the group or page configuration file?
A: Yes, that is usually the best method. If you were doing this with many scattered pages, or with several languages, you might find it easier to maintain if you load the translations all in config.php like this:
XLPage('es','PmWikiEs.XLPage');
XLPage('fr','PmWikiFr.XLPage');
XLPage('ru','PmWikiRu.XLPage');
$XLLangs
= array('en');
A: Then in each group or page configuration file, you'd just use $XLLangs
= array('es'); to set the language to use (in this case, Spanish). Note that though this method is easier to maintain, its somewhat slower because it loads all the dictionaries for each page view, even if they won't be used.
Q: What does the first parameter of this function stand for? How can it be used?
A: The XLPage mechanism allows multiple sets of translations to be loaded, and the first parameter is used to distinguish them.
For example, suppose I want to have translations for both normal French and "Canadian" French. Rather than maintain two entirely separate sets of pages, I could do:
XLPage('fr-ca', 'PmWikiFrCa.XLPage'); XLPage('fr', 'PmWikiFr.XLPage');
PmWikiFr.XLPage would contain all of the standard French translations, while PmWikiFrCA.XLPage would only need to contain "Canada-specific" translations -- i.e., those that are different from the ones in the French page.
The first parameter distinguishes the two sets of translations.
In addition, a ''config.php'' script can use the $XLLangs
variable
to adjust the order of translation, so if there was a group or
page where I only wanted the standard French translation, I
can set
$XLLangs
= array('fr', 'en');
and PmWiki will use only the 'fr' and 'en' translations (in that order), no matter how many translations have been loaded with XLPage().
Q: How can I add a translation for an individual string in a PHP file?
A: Use the XLSDV() function to provide a translation for a specific (English) string. For instance, with this in config.php
XLSDV('nl', array('my English expression'=>'mijn Nederlandse uitdrukking'));
any instance of the variable expression $[my English expression]
in wiki mark-up will be displayed as ''my English expression'' in default (English) context, but as ''mijn Nederlandse uitdrukking'' in Dutch (nl) context, i.e. when XLPage('nl',...)
has been called for that page in config.php or a cookbook recipe.
If you need to get a translation in a PHP file, use the XL()
function:
$local_string = XL("my English expression");
But beware: XLPage() uses XLSDV() internally for its translation pairs, too, and only the first definition is accepted! Thus, if the Dutch XLPage already contains a translation and you want to override that, you need to use your XLSDV('nl',...) ''before'' calling the correspondent XLPage('nl',...). Otherwise, by using XLSDV() ''after'' XLPage() - e.g. within a recipe that is included later in config.php - your translation will only work as long nobody defines 'my English expression' in that XLPage.
>><<
LocalCustomizations
>>faq<< >>faq<< Q: There's no "config.php"; it's not even clear what a "local customisation file" is! A: The "sample-config.php" file in the "docs" folder, is given as an example. Copy it to the "local" folder and rename it to "config.php". You can then remove the "#" symbols or add other commands shown in the documentation. See also Group Customizations.
Q: Can I change the default page something other than Main.HomePage ($DefaultPage
)?
A: Yes, just set the $DefaultPage
variable to the name of the page you want to be the default. You might also look at the $DefaultGroup
and $DefaultName
configuration variables.
->$DefaultPage = 'ABC.StartPage';
Q: How do I get the group / page name in a local configuration file (e.g. ''local/config.php'')? A: Use the following markup in pmwiki-2.1.beta21 or newer:
->
## Get the group and page name $pagename = ResolvePageName($pagename); $page = PageVar($pagename, '$FullName'); $group = PageVar($pagename, '$Group'); $name = PageVar($pagename, '$Name');
Note the importance of the order of customizations in config.php above to avoid caching problems.
If you need the verbatim group and page name (from the request) early in config.php, $pagename is guaranteed to be set to # Any value of ?n= if it's set, or # Any value of ?pagename= if it's set, or # The "path info" information from REQUEST_URI (whatever follows SCRIPT_NAME), or # Blank otherwise according to this posting
Q: Can I remove items from the wikilib.d folder on my site? A: The files named Site.* and SiteAdmin.* contain parts of the interface and the configuration and they should not be removed. The other files named PmWiki* contain the documentation and could be removed.
Q: How do I customize my own 404 error page for non-existent pages? A: To change the text of the message, try editing the Site.PageNotFound page.
Q: Is the order of customizations in config.php important? Are there certain things that should come before or after others in that file? A: Yes, see Order of the commands in config.php. >><<
GroupCustomizations
>>faq<< >>faq<< Q: How can I apply CSS styles to a particular group or page?
A: Simply create a ''pub/css/Group.css'' or ''pub/css/Group.Page.css'' file containing the custom CSS styles for that group or page. See also Cookbook:LocalCSS.
Q: Why shouldn't passwords be set in group (or page) customization files? Why shouldn't group or page passwords be set in config.php?
A: The reason for this advice is that per-group customization files are only loaded for the current page. So, if @@$DefaultPasswords['read']@@ is set in ''local/GroupA.php'', then someone could use a page in another group to view the contents of pages in GroupA. For example, Main.WikiSandbox could contain:
--> (:include GroupA.SomePage:)
and because the ''GroupA.php'' file wasn't loaded (we're looking at Main.WikiSandbox --> ''local/Main.php''), there's no read password set.
The same is true for page customization files.
Q: Isn't that processing order strange? Why not load per page configuration last (that is after global configuration an per group configuration)?
A: Many times what we want to do is to enable a certain capability for a group of pages, but disable it on a specific page, as if it was never enabled. If the per-group config file is processed first, then it becomes very difficult/tedious for the per-page one to "undo" the effects of the per-group page. So, we load the per-page file before the per-group.
If a per-page customization wants the per-group customizations to be performed first, it can use the techniques given in PmWiki.GroupCustomizations (using ''include_once()'' or setting @@$EnablePGCust = 0@@). >><<
Skins
>>faq<< >>faq<<
Q: How do I change the Wiki's default name in the upper left corner of the Main Page?
A: Put the following config.php
->$WikiTitle = 'My Wiki Site';
The ''docs/sample-config.php'' file has an example of changing the title.
Q: How can I embed PmWiki pages inside a web page?
A: Source them through a PHP page, or place them in a frame.
Q: How do I change the font or background color of the hints block on the Edit Page?
A: Add a CSS style to pub/css/local.css: .quickref {background:...; color:... }
. The hints are provided by the Site.EditQuickReference page, which is in the PmWiki or Site wikigroup. Edit that page, and change the "bgcolor" or specify the font "color" to get the contrast you need.
>><<
SkinTemplates
>>faq<< >>faq<<
Q: How do I customize the CSS styling of my PmWiki layout?
A: See Skins for how to change the default PmWiki skin. See also Skins, where you will find pre-made templates you can use to customize the appearance of your site. You can also create a file called ''local.css'' in the ''pub/css/'' directory and add CSS selectors there (this file gets automatically loaded if it exists). Or, styles can be added directly into a local customization file by using something like:
-> $HTMLStylesFmt[] = '.foo { color:blue; }';
Q: Where can the mentioned "translation table" be found for adding translated phrases? A: See Internationalizations.
Q: Is it possible to have the edit form in full page width, with no sidebar?
A: If the sidebar is marked with <!--PageLeftFmt-->
, adding (:noleft:)
to Site.EditForm will hide it when a page is edited.
Q: Can I easily hide the Home Page title from the homepage? A: Yes, you can use in the wiki page either @@(:title Some other title:)@@ to change it or @@(:notitle:)@@ to hide it.
Q: Is it possible to hide the Search-Bar in the default PmWiki Skin? A: Yes, please see Cookbook:HideSearchBar.
>><<
WebFeeds
>>faq<< >>faq<<
Q: How do I include text from the page (whole page, or first X characters) in the feed body? (note: markup NOT digested)
function MarkupExcerpt($pagename) { $page = RetrieveAuthPage($pagename, 'read', false); return substr(@$page['text'], 0, 200); }