AutomaticLinks
Question
How to automatically create Crosslinks for use in e.g. a glossary?
Answer
Use the script autolink.phpΔ . Insert the following line in your config.php
:
include_once("$FarmD/cookbook/autolink.php");
Notes
This script takes the titles of all files in a specific group and saves them together with the filename in a file called ".autolink-<groupname>" in the wiki.d directory. This file is dynamically created as soon a file in the group is deleted or changed, the corresponding information is changed also. This file is saved in a compressed format.
The first call will create a new file. Thus the loading time of the page for the initial creation of that file might be a little bit longer (up to some seconds), depends on the amount of files within the group though.
By default all titles which are shorter than two characters are ignored. This is controlled by the variable $AutoLinkMinSize
which defaults to '2'.
The effect the user can see is that the wikipage contains some links that are not marked as links in the wikitext source. E.g the text "Start Page" is converted to e.g. Start Page automatically.
Activation of automatic links is currently only possible in the config files. I suggest to only activate it for the desired group. See GroupCustomizations for details.
Insert the following line:
AutoLinkActivate($groups);
where the string $groups
contains a string with the desired source groups seperated by a space character, e.g.
AutoLinkActivate("PmWiki Main");
- This recipe was last tested on PmWiki version: 2.1 beta26
- This recipe requires at least PmWiki version: and (any other recipes)
- This recipe, version...... was installed here the...(date)
Releases
- 2006-02-17 initial release.
- 2006-02-17 fixed bug with corrupting
Attach:
markup with some help of Pm - 2006-02-24 fixed warning messages when SearchPatterns['default'] was not set
See Also
Contributors
Comments
See discussion at AutomaticLinks-Talk
User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.