version=pmwiki-2.2.5 ordered=1 urlencoded=1 agent=Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 author=overtones99 charset=ISO-8859-1 csum=typo ctime=1138284686 host=76.172.126.33 name=PmWiki.LinkIMap rev=15 targets=PmWiki.Functions,PmWiki.MakeLink,PmWiki.InterMap,Category.PmWikiInternals text=(:Summary: Description PmWiki's internal function LinkIMap() :)%0aThis page describes an internal function in PmWiki's engine called [@LinkIMap@](). The contents are not intended for those with a weak heart ;-) %0a%25audience%25 Admins (advanced)%0a%0aAlso see: [[PmWiki.Functions#LinkIMap]], [[PmWiki.MakeLink]]%0a%0a:'''Syntax''':   @@LinkIMap@@($pagename,$imap,$path,$title,$text,$fmt=NULL)%0a%0aThe function @@LinkIMap@@() handles links of the form @@scheme:path@@, which%0aincludes @@http:@@, @@https:@@, @@ftp:@@ as well as the [[inter map]] links%0asuch as @@Cookbook:@@, @@PmWiki:@@ etc.%0a%0aThe basic markup behind the eventual invocations of this function is as follows:%0a%0a '''[=[[=]''' ''%3ctarget>''[==]'''"'''[==]''%3ctitle>''[==]'''"''' '''|''' ''%3clink-text>'' ''']]'''%0a '''[=[[=]''' ''%3clink-text>'' '''->''' ''%3ctarget>''[==]'''"'''[==]''%3ctitle>'' ''']]'''%0a '''[=http://=]'''[==]''%3cURI>''[==]'''"'''[==]''%3ctitle>''[==]'''"'''%0a%0aThe arguments to the function are as follows:%0a%0a* $pagename — a string with the name of the page context in which the%0a link is created, this is typically simply the name of the current page.%0a For example, $pagename could be @@"Group.SomePage"@@.%0a%0a* $imap — a string denoting the scheme, i.e. the index into%0a $LinkFunctions. For example, $imap could be @@"http:"@@.%0a%0a* $path — a string with the part of the target after the scheme%0a%0a* $title — a string with the optional part after the target within%0a quotes%0a%0a* $text — a string with the link text, from @@[[MakeLink]]@@()%0a%0a* $fmt — a string with the format string, from @@[[MakeLink]]@@()%0a%0aThe array @@$IMap@@ is the primary array used by @@LinkIMap@@(). It says how%0ato format a URL according to the given scheme. By default, this array is%0agenerally set as follows:%0a%0a[@%0a $IMap['http:'] = 'http:$1';%0a $IMap['https:'] = 'https:$1';%0a $IMap['ftp:'] = 'ftp:$1';%0a $IMap['mailto:'] = 'mailto:$1';%0a ...%0a $IMap['Cookbook:'] = 'http://www.pmwiki.org/wiki/Cookbook/$1';%0a $IMap['PmWiki:'] = 'http://www.pmwiki.org/wiki/PmWiki/$1';%0a $IMap['Wikipedia:'] = 'http://www.wikipedia.com/wiki/$1'; %0a@]%0a%0aNote that the @@$1@@ in each case is used as a placeholder for the path%0acomponent. %0a%0a@@LinkIMap@@() then uses the value of $UrlLinkFmt to generate the link. The%0adefault value of $UrlLinkFmt is as follows:%0a%0a "%3ca class='urllink' href='\$LinkUrl' rel='nofollow'>\$LinkText%3c/a>"%0a%0aThen there is also the array $IMapLinkFmt that allows each scheme to have%0aits own custom formatting default. The vanilla version of PmWiki doesn't use%0athis array yet, although some cookbook recipes probably do.%0a%0aExamples of custom formats to allow different styling via classes: %0a* Links to http: standard url links:%0a--> [@%0a$IMapLinkFmt['http:'] =%0a "%3ca class='httplink urllink' href='\$LinkUrl'>\$LinkText%3c/a>";%0a@]%0a* Links to https: secure pages:%0a--> [@%0a$IMapLinkFmt['https:'] =%0a "%3ca class='httpslink urllink' href='\$LinkUrl'>\$LinkText%3c/a>";%0a@]%0a* Links to PmWiki: InterMap shortcut:%0a--> [@%0a$IMapLinkFmt['PmWiki:'] =%0a "%3ca class='pmwikilink urllink' href='\$LinkUrl'>\$LinkText%3c/a>"; %0a@]%0a* Links to Cookbook: InterMap shortcut %0a--> [@%0a$IMapLinkFmt['Cookbook:'] =%0a "%3ca class='cookbooklink urllink' href='\$LinkUrl'>\$LinkText%3c/a>"; %0a@]%0a%0aCategory: [[!PmWiki Internals]]%0a time=1251333884