PTVPopups

Summary: Create CSS popups over words on a page based on PTVs
Version: 2017-07-26
Prerequisites: CSS2, MarkupToUnstyled
Status: Stable
Maintainer: ccox
License: GPL
Categories: CSS
Users: (view? / edit)
Discussion: PTVPopups-Talk

Questions answered by this recipe

Can I create a popup for words on my pages, like against a glossary of terms for example?

Description

Create CSS popups over words on a page based on PTVs

Installation

This recipe depends upon MarkupToUnstyled.

Download ptvpopups.phpΔ and add it to your config.php:

 
 include_once("cookbook/ptvpopups.php");
 

Configuration

Create a page with PTVs on it, where the PTV is the name or phrase you want to get a hover popup on, and the value is what the popup should say. For example PmWiki/Glossary.

Because a PTV must be essentially be a "word", in order to do phrases, you merely create the name of your PTV using double-underscores. Thus creating Local__configuration__file if you want to match that phrase. If enabled (see below) on the page of PTVs itself, it will substitute a space for the double underscores.

If you don't want to enable the popups on the page of PTVs itself, you can always enable the following markup for that page instead (implementation details not provided here):

 
 Markup('__', '>inline', '/__/', ' ');
 

Usage

Simply reference the page of PTVs you want to activate on a page.

 
 {(ptvpopups PmWiki/Glossary)}
 

Notes

Change log / Release notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

  • 2017-07-24 Change >restore to <restore. "Keep" needs to mean "keep". Fixes problem of markup rewriting edit text area on edit when Preview is selected.
  • 2017-07-26 Optimizations suggested by Petko. Thanks Petko!

See also

Contributors

  • Petko (optimization)

Comments

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