CMSBundleAddLink

Summary: An AddLink Bookmarklet recipe: (:AddLink:)
Version: 2017-01-30
Prerequisites: >=PmWiki 2.1.x
Status: Beta
Maintainer: Hagan Fox
Categories: CMS, PageDirectives, PHP55
Users: (view? / edit)

Questions answered by this recipe

How can I easily add pre-marked-up links to wiki pages using a bookmarklet.

Description

Add links to wiki pages using a bookmarklet.

Files

 cookbook/
 |-- cmsb-addlink.php
  `- cmsb-addlink-README.txt

Installation

Unpack the archive in your cookbook directory and add this to your configuration file (e.g. config.php):

##  Enable the AddLink Bookmarklet recipe.
if (preg_match('/^(edit|browse|addlink|logout)$/', $action)) {
  @include_once("$FarmD/cookbook/cmsb-addlink.php"); }

Configuration

Configuration is optional. There are four settings.

##  Enable the AddLink Bookmarklet recipe.
# $AddLinkText ="$[Add a link to ]".$pagename; // link text
# $AddLinkTitle ="$[AddLink Bookmarlket]";     // tooltip
# $EnableAddLinkTitleStyle = 1; // Use a heading rather than a definition.
# $EnableAddLinkToEnd = 1;      // Place the link at the end of the page.
if (preg_match('/^(edit|browse|addlink|logout)$/', $action)) {
  @include_once("$FarmD/cookbook/cmsb-addlink.php"); }

Usage

TL;DR

  • Bookmark the link, then go to a page and click the bookmark.
  • Optionally you can highlight some text in the page before clicking the bookmark.

Details

This recipe creates an "add link" bookmarklet that makes it easy save web site links in your wiki. It works like this:

  • Insert (:addlink:) in a page.
  • Add the link as a bookmark in your browser.
  • Optionally delete the (:addlink:) markup from the page.
  • Surf the web and find a page you want to bookmark.
  • Highlight some descriptive text in the page.
  • Use the bookmark.

Your browser will be taken to your site in edit mode. By default the page's title will become a definition term and the text you highlighted will become the definition for the term. A bookmark for pmwiki.org has markup that looks like this

:[[http://www.pmwiki.org/wiki/Cookbook/CMSBundle|PmWiki | Cookbook / CMSBundle]]:Some scripts that add features useful for a CMS-type installation.

and renders like this

PmWiki | Cookbook / CMSBundle
Some scripts that add features useful for a CMS-type installation.

Optionally you can have the recipe create "heading style" (a.k.a. Herber style) markup that looks like this

!!!PmWiki | Cookbook / CMSBundle

http://www.pmwiki.org/wiki/Cookbook/CMSBundle

Some scripts that add features useful for a CMS-type installation.

and renders like this

PmWiki | Cookbook / CMSBundle

http://www.pmwiki.org/wiki/Cookbook/CMSBundle

Some scripts that add features useful for a CMS-type installation.

Notes

This is a fork of an old version of the AddLinkBookmarklet recipe, which at the time seemed unmaintained and overlooked. At this point it's significantly different from the original.

Despite the name, this is a stand-alone script. Other recipes from CMS Bundle are not required.

Change log / Release notes

  • 2015-11-06 - The browser sniffing now smells newer browsers. Also now escaping the vertical-bar character in URLs.
  • 2016-09-16: Some cleanup + added a setting so the link text and the link title (tooltip) are separate settings ($AddLinkText and $AddLinkTitle respectively). Moved README text to a separate file and bundled as an archive you can unpack from the cookbook/ directory.
  • 2017-01-30: PHP 5.5+ bug fixed.

See also

Contributors

Comments

See discussion at CMSBundleAddLink-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.