Summary:Gives easy access to creating some types of custom markup.
Users: +1 (View / Edit)

Questions answered by this recipe

  • How can I utilize Markup without knowing regex?
  • How can I make it easier to type out links?
  • How can I create a cross-reference list?
  • How can I redirect an entire group?

...and more!


Makes creating your own markup, link-shortcuts, redirects and more WAY EASY!

It works like this:

  1. Upload this to your /cookbook directory: shortcuts.phpΔ
  2. Add this to local/config: include("$FarmD/cookbook/shortcuts.php");
  3. Create Site.ShortCuts and make a definition list of :whatbecomes:what, eg:

:floatad:(:include Site/GoogleFloatAd:)
:moviecatch:**Wikzilla**://Wikness the Page Variables!//

  1. Anywhere on your site, summon your ShortCuts like so:



Use these variables BEFORE the % to...

  • Change the ShortCuts page:

$ShortCutsPage = "Main.GroupShortening";

  • Change the Prefix and Suffix for to activate the shortcuts:

$ShortCutsPrefix = "[[";
$ShortCutsSuffix = "/";


The above Prefix and Suffix combo is dangerous to most wiki setups, however, a careful Administrator can do some cool things with this...

For instance, if your ShortCuts page has a list of all your groups in the definition list, you then have the ability to shorten every single group's name as well as the option to redirect entire groups at once.

In a site that's about planning for upcoming holidays, for example, the definition list could look like this:

:L:[[Labor Day/

With a final line that says:


Thus, For all links that specifically link to a given holiday, you can write them in the regular fashion. HOWEVER, all of your main pages, your sidebar, your recipes list, and so on can all link to [[Now/whatever... Then all you need do is change one line of your ShortCuts page and your entire site is updated to the next holiday.

The canniest wikizens will see even more uses for this sort of thing.

Finally, if you want to have multiple markups that's REALLY easy... Just do something like the following:

//so that you can easily reference ANY link on your links page...
$ShortCutsRedux = "1";
$ShortCutsPage = "Main.Links";
$ShortCutsPrefix = '?';
$ShortCutsSuffix = '?';

//so that you can set your blog automatically show where you are on your rock tour of the world...
// Blog.GroupHeader: #2007-08-31#
// in Tour.CurrentInfo: :2007-08-31:August 31 - New York City!
$ShortCutsRedux = "2";
$ShortCutsPage = "Tour.CurrentInfo";
$ShortCutsPrefix = '#';
$ShortCutsSuffix = '#';

//so you can automatically turn code like this: >happy> into smiley faces. Get it?
$ShortCutsRedux = "3";
$ShortCutsPage = "Site.MakeSmiles";
$ShortCutsPrefix = '>';
$ShortCutsSuffix = '>';

The $ShortCutsRedux is required so that the different sets of markup rules don't overwrite one another.


Release Notes



See discussion at ShortCutsMarkup-Talk

Hi, Mike,

I already do things like the Now markup example you gave using pagetextvariables or conditional statements. For example: my sales page on Eclectic Tech is set up to change text monthly with an if date statement -- I wouldn't have to say "change my site for Halloween" -- it would just happen on the date I tell it to. If I wanted to, I could also use if conditionals with a pagetextvar (PTV) on a SiteAdmin page: content ThisHoliday:Halloween is then referred to as on other pages and I can use a conditional such as (:if equal {SiteAdmin/WhatHoliday$:ThisHoliday} "Halloween":)The Great Pumpkin is going to get you!....(:ifend:) to change content.
Just thought I'd give you that tip. Looks like an interesting recipe. Thanks! XES January 08, 2008, at 04:27 PM
That's a great idea XES! I've been away from PmWiki for a while, and now that I'm back, I was also questioning the same thing, after all, all ShortcutsMarkup really does is turn your #short# into references to and then into whatever $:short is defined as. PmWiki still does the rest.
That said, ShortcutsMarkup is still the easiest way for references that change often or that aren't planned. When I work on scripts or stories, I use shortcuts to easily link together my #plots#, #characters#, #objects#, and #chapters#, which subsequently turn into titled and complete links. I haven't written full any proper names is ages, because #tb# is enough to reference TaraBelland?
Been using this for a private wiki and used '.' as the prefix/suffix. Just realized it's broken links containing because it thinks maybe ".something." is a shortcut, and strips it out without putting it back when it doesn't match a shortcut. When a regex match doesn't match the defined shortcuts, the prefix/suffix/word captured should be put BACK into the text for further processing. To prevent catching false positives. :) I did things like '.x.' and there's a 2-letter '.th.' — these are unlikely to be found in domain names :) I could go through my whole site and say switch to a comma, but man what a pain that would be ;) — my quick hack was to make it so it only accepts a 1-2 letter shortcut with '([0-9a-zA-Z][0-9a-zA-Z]?)' in the regex. XES February 28, 2018, at 05:35 AM

See Also

EnableHTML - So you can easily include GoogleAds and other stuff...



User notes +1: 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.