AddLinkBookmarklet
Question
How can I easily use PmWiki to bookmark pages I find on the web?
Answer
This cookbook recipe provides a bookmarkable link (a "bookmarklet") that you can put in your browser to quickly add links to wiki pages as you surf the web.
Description
PmWiki is an excellent tool for maintaining lists of links on the web, but there are too many steps (find the page, copy the URL of the page you wish to save, open the wiki page to edit, paste the URL into the wiki page, hit save).
With the addlink.php script, you can simply click on a link (bookmarked within your browser) to quickly add the URL of the currently viewed page into a wiki page.
Installation
1. Copy the latest version (see below) as addlink.php into your cookbook/ directory, then add the following line into your config.php file:
include_once("$FarmD
/cookbook/addlink.php");
2. Browse to the wiki page on which you would like to save links, and place the markup (:addlink:)
into that page.
3. The (:addlink:)
markup will become a link that says +=pagename . Bookmark that link in your browser.
4. Now, you can surf the web, and when you find something you want to save in the wiki page, click the bookmark page. You'll instantly be transported to the wiki page with the (:addlink:)
markup in it, and the URL of the page you were viewing is automatically added at the top and ready for you to annotate or edit.
Configuration
The following variables can be used in your local/config.php
# Add links to the bottom instead of the top? $EnableAddLinkToEnd=1; # default=0 # What text should be added immediate before and after each new link? # The default is a newline before and after. $AddLinkPrefixText="sometext"; # default="\n" $AddLinkSuffixText="sometext"; # default="\n"
Changelog
2018-01-13: addlink2.0.3.phpΔ (NilsKnappmeier)
Fix for the syntax "(:addlink "PageName":), which was broken in version 2.0.2 The syntax now works (adding links to "PageName" rather than the current page).
2018-01-12: addlink2.0.2.phpΔ (NilsKnappmeier)
Modified to prevent "preg_replace /e"-warnings and to work with PHP 7 (not actually tested yet with PHP 7)
2007-08-07: addlink2.0.1.phpΔ (MikeShanley?)
Support for configuration options $EnableAddLinkToEnd, $AddLinkPrefixText and $AddLinkSuffixText
2006-03-21: Bugfix
ugly workaround that sets $action='edit'
in order for the EditForm to be loaded correctly. (addlink2.php only)
2006-03-08: Bugfix (NilsKnappmeier)
Bugfix (addslashes before HandleEdit)
2006-02-12: addlink2.phpΔ NilsKnappmeier
Improved version of the script, which asks the user for link-text before adding the link to the target page. If a link text is entered (into a java-script prompt-box), it will create a real link of the form [[link text -> url]]
. The server-side code is compatible with bookmarks of version 1.
2004-??-??: addlink.phpΔ NilsKnappmeier
Initial version: The script provides a bookmarkable link (a "bookmarklet") that you can put in your browser to quickly add links to wiki pages as you surf the web.
See Also
- Test.AddLinkBookmarklet for a demonstration
- CMSBundle#addlink - A variant with some significant differences.
- Bookmarklet display bookmarklet links on a PMWiki page.
Contributors
- Nils Knappmeier -- original concept
- MikeShanley? -- a few more improvements
- Christian Ridderström -- improvements to original concept
- Pm -- conversion for PmWiki 2 (2004-11-30)
Comments
See discussion at AddLinkBookmarklet-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.