version=pmwiki-2.2.39 ordered=1 urlencoded=1
author=mfwolff
charset=UTF-8
csum=Typo
name=PmWiki.InterMap
rev=56
targets=PmWiki.WikiWikiWeb,Site.InterMap,PmWiki.Variables,Cookbook.RelativeUrls,Cookbook.RelativeLinks,PmWiki.LinkSchemes,PmWiki.WikiFarms,PmWiki.Upgrades
text=(:Summary: Interwiki links definition and use:)%0a(:Audience: author (intermediate) :)%0a%0aThe InterMap (also called InterWiki in some other wikis) is a system for defining links between [[WikiWikiWeb]] sites that was first developed by UseMod and Meatball (see UseMod:InterWiki and Meatball:InterWiki).  The method is to use a word shortcut that stands for a defined path. InterMap links have the form [@MapPrefix:PagePath@], where the host prefix is converted to a partial URL based on entries in the site's ''intermap.txt'' and ''localmap.txt'' files.%0a%0a[[#custominclude]]%0a!! The default intermap.txt%0a%0aThe default ''intermap.txt'' distributed with PmWiki (in the ''scripts/'' directory) includes the following InterMap entries:%0a>>pre%3c%3c%0a PmWiki:     http://www.pmwiki.org/wiki/PmWiki/ %0a Cookbook:   http://www.pmwiki.org/wiki/Cookbook/ %0a Wiki:       http://www.c2.com/cgi/wiki? %0a UseMod:     http://www.usemod.com/cgi-bin/wiki.pl? %0a Meatball:   http://www.usemod.com/cgi-bin/mb.pl? %0a Wikipedia:  http://en.wikipedia.org/wiki/ %0a PITS:       http://www.pmwiki.org/wiki/PITS/ %0a PmL10n:     http://www.pmwiki.org/wiki/Localization/%0a Path:%0a>>%3c%3c%0a%0a!! The page [[{$SiteGroup}.InterMap]]%0a(:if exists {$SiteGroup}.InterMap:)%0a[[{$SiteGroup}.InterMap]] includes the following entries:%0a(:include {$SiteGroup}.InterMap#include#includeend:)%0a(:else:)%0aYou can map your own prefixes in your local page [[{$SiteGroup}.InterMap]].%0a(:ifend:)%0a[[#customincludeend]]%0a%0aThus, "PmWiki:Variables" becomes "http://www.pmwiki.org/wiki/PmWiki/" + "Variables," a link to the [[PmWiki.Variables->http://www.pmwiki.org/wiki/PmWiki/Variables]] page on the official PmWiki web site, Wiki:FrontPage is a link to the front page of the first WikiWikiWeb, and Wikipedia:Stonehenge takes you to the Wikipedia article about the famous megaliths in England.  %0a%0a!! Usage in a wiki page%0a%0aLike other links, you can use the double-bracket syntax to get different link text:%0a(:markup class=horiz:)%0a* [[Meatball:StartingPoints | starting points]] over at Meatball%0a* [[starting points -> Meatball:StartingPoints]] over at Meatball%0a(:markupend:)%0a%0aIf you want to link just to what the intermap says (e.g. http://www.wikipedia.com/wiki/ for Wikipedia), then do [@[[Wikipedia:. | Wikipedia's main page]]@], which produces [[Wikipedia:. | Wikipedia's main page]].  Note the . (period) after the Map: reference.%0a%0a[[#path]]%0aThe special [@Path:@] InterMap entry can be used to create "[[Cookbook:RelativeUrls|relative urls]]" in [[Cookbook:RelativeLinks|links]].%0a%0a!! Custom InterMap prefixes%0aThe actual set of InterMap links at any site is defined by the site administrator via the [[Site.InterMap]] page and the ''local/localmap.txt'' file.%0a%0aAn intermap entry takes the following format:%0a%0a-> [@%0aMapPrefix:      http://example.com/partial/url/%0a@]%0a%0aThe InterMap entry can be for any of the [[(PmWiki:)link schemes]] supported by PmWiki.%0a[[%3c%3c]]%0aYou can create your own InterMap links by doing one or more of the following:%0a%0a* Modify the page called ''[[{$SiteGroup}.InterMap]]'' and place entries like the ones above in it.%0a* Create a file called ''local/localmap.txt'' and place entries like the ones above in it.%0a* In a [[WikiFarm(s)]] installation you can create a file called%0a  ''local/farmmap.txt'' and there place entries like the ones above in it.%0a  These prefixes will be common to all the wikis in the farm.%0a* Ensure that there is a space after the colon.%0a%0aDo not edit the file ''scripts/intermap.txt'' directly!  If you do, you'll%0alose your changes when you [[PmWiki/upgrade(s)]] PmWiki.%0a%0a%0a!! Variables and InterMap links%0a%0aIt's possible to use variables within your InterMap entries.  The following%0aentries create [@ThisWiki:@] and [@ThisPage:@] shortcuts:%0a%0a-> [@%0aThisWiki:        $ScriptUrl%0aThisPage:        {$PageUrl}%0a@]%0a%0aYou can also define InterMap entries where the text of the entry is%0asubstituted into the middle of the URL.  Just include '$1' in the URL where%0ayou want the substitution to take place.  For example:%0a%0a->[@Jargon:          http://catb.org/~esr/jargon/html/$1.html@]%0a%0awould cause [@Jargon:F/feature-creep@] to be converted to [@http://catb.org/~esr/jargon/html/F/feature-creep.html@].%0a%0a%0a!! Tips and tricks%0a%0aIt is possible to document your intermap prefixes directly in the page%0a[[Site.InterMap]]. The extra text will not cause a performance penalty, nor%0awill it break the definition of prefixes. However, be aware that anything%0amatching a line starting with a word and a colon (''':''') will be%0aconsidered to define a prefix.%0a%0aThe order in which various sources are checked for definitions of prefixes%0ais controlled by the variable $InterMapFiles. Currently the precedence%0a(highest to lowest is as follows):%0a* ''local/localmap.txt''%0a* ''$SiteGroup.InterMap''%0a* ''$FarmD/local/farmmap.txt''%0a* ''$FarmD/scripts/intermap.txt''%0a%0a%0a>>faq%3c%3c [[#faq]]%0a%0aQ: Are InterMap names case sensitive?%0aA: Yes, thus [@eAdmin:@] is a different InterMap link than [@EAdmin:@].%0a%0aQ: How can I achieve a ''localmap.txt'' mapping with the effect of [@Pics: Path:/somepathto/pics/@]?%0aA: Use the following:%0a->[@Pics:     /somepathto/pics/@]%0a%0a%0aQ: How can I define an InterMap in PHP?%0aA: Use the following:%0a->[@%0a      $LinkFunctions['PmWikiHome:'] = 'LinkIMap';%0a      $IMap['PmWikiHome:'] = 'http://pmwiki.org/wiki/$1';%0a@]%0a
time=1341925508
