[pmwiki-users] Popup messages

Stirling Westrup sti at pooq.com
Sun Oct 29 01:47:57 CDT 2006


IchBin wrote:
> Say I have a paragraph of text or a list of terms displayed on a page. 
> In that paragraph or list I may have n->terms that I would like to be 
> able to display its definition. I really do not want to load a page of 
> definitions and then reference directly to it with a [[#term]]. I would 
> like to stay on the same page as the term.
> 
> When the user hovers over a term I can popup a small message window with 
> its definition. Something on the lines of a queued process on a word 
> hover. Then I guess it would be more like a XMLHttpRequest call. Hope my 
> question make sense.
> 
> Just wondering if there are any recipes, or part of a recipe, that could 
> help me or get me going in the right direction? Do people build recipes 
> that can utilize javascript.  Sorry, I do not have a clue.

My recently completed QuickReplace recipe can do 90% of that work.

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

It allows you to associate keys with values using a configuration
wiki-page and lets there be a custom output format for inserting the
results in a page. You would end up editing Site.Terms (or something
similar) and putting in terms and definitions like:

'holomorphic function' => 'Holomorphic functions are the central object
of study of complex analysis; they are functions defined on an open
subset of the complex number plane C with values in C that are
complex-differentiable at every point. This is a much stronger condition
than real differentiability and implies that the function is infinitely
often differentiable and can be described by its Taylor series. The term
analytic function is often used interchangeably with "holomorphic
function", although note that the former term has several other
meanings. A function that is holomorphic on the whole complex plane is
called an entire function. The phrase "holomorphic at a point a" means
not just differentiable at a, but differentiable everywhere within some
open disk centered at a in the complex plane.'

You would then create a QuickReplace instance in your local/config.php
by entering something like:

$QuickReplace['Terms'] = array
  ( 'output' => '<mysterious $1 html $2 stuff>'
  );
include_once("cookbook/quickreplace.php");

Then whenever you used the words "holomorphic function" in a page, they
would be replaced by <mysterious $1 html $2 stuff>, with the $1 and $2
replaced by that term and its definition.

The problem is, I don't know what HTML/javascript/whatever you would use
to create a popup that behaved like you wished. If you could tell me
that, I could probably give you a working recipe.




More information about the pmwiki-users mailing list