Officers of the church Ministry support pages available: Children Elders Life Groups Praise Team Block Party Serving schedules: Home Visitation Meditation |
PmWiki /
MakeLink
This page describes an internal function in PmWiki's engine called admins (advanced) Also see: PmWiki.Functions#MakeLink Syntax:
|
Invocation: | MakeLink( |
Result: | "<a href='.../Group/SomePage'>SomePage</a>" |
Invocation: | MakeLink( |
Result: | "<a href='.../Group/SomePage'> page</a>" |
Invocation: | MakeLink( |
Result: | "<a href='.../Group/SomePage'>other text</a>" |
Invocation: | MakeLink( |
Result: | "<a href='.../uploads/Group/file.doc'>other text</a>" |
Invocation: | MakeLink( |
Result: | "<a href='.../Group/SomePage'>other text-suffix</a>" |
Invocation: | MakeLink($pagename, "install(ation)", NULL, "ed") |
Result: | "<a href='.../Group/Installation'>installed</a>" |
Invocation: | MakeLink($pagename, "SomePage", '', '', "<a href='.../\$LinkUrl'>\$LinkText</a>") |
Result: | "<a href='.../Group/SomePage'>SomePage</a>" |
Invocation: | MakeLink($pagename, "Attach:foo.gif", '', '', $ImgTagFmt) |
Result: | "<img src='.../uploads/foo.gif' alt='' />" |
MakeLink()
know the type of link?The array $LinkFunctions contains a list of prefixes to recognize and
subroutines to call when $target
contains that prefix. The default settings
for $LinkFunctions goes something like:
$LinkFunctions['http:'] = 'LinkIMap'; $LinkFunctions['https:'] = 'LinkIMap'; $LinkFunctions['mailto:'] = 'LinkIMap'; # ...
Thus, any target that looks like a url is created using the LinkIMap()
function. For attachments, we have
$LinkFunctions['Attach:'] = 'LinkUpload';
which calls the LinkUpload()
function to handle attachment links.
If $target
doesn't match any of the prefixes in $LinkFunctions, then
MakeLink assumes the target is a page name and it uses the entry in
$LinkFunctions['<:page>']
, which by default says to call the LinkPage()
function.
After that, it's up to the per-target function to figure out how
the link is to be correctly formatted. Each target function has
its own set of $...Fmt variables that control formatting for
the target, but if MakeLink()
is passed a value for $fmt
then
the target function is supposed to use that value in lieu of its
default. This is how we're able to do inline images (see the
"img" rule in scripts/stdmarkup.php
), as well as use MakeLink()
to get at other items of the resulting target link.
MakeLink()
remove parenthesis from the target? See Links#othertext, Link text within (parentheses) will not be not displayed, so that [[(wiki) sandbox]]
links to WikiSandbox but displays as sandbox. For addresses actually containing parentheses, use %28 and %29 https://www.example.com/linkwith%28parenthese%29. --Petko?
Category: PmWikiInternals
This page may have a more recent version on pmwiki.org: PmWiki:MakeLink, and a talk page: PmWiki:MakeLink-Talk.