Help:Creating pop up help boxes

From SABR Encyclopedia

Jump to: navigation, search

This article is directed at Encyclopedia administrators who maintain the forms used to edit pages. It offers no useful information for researchers or Encyclopedia moderators.

You can create pop up help boxes in the Encyclopedia using a small php script and the functionality of floatbox. This page quickly documents how to do so.

[edit] Create the help page

These pages go in the Help: namespace, and should all contain the template include {{popup}} which simply places them in a category so they're easy to find. They can contain normal formatting, but should not contain links, since the behavior of links in popups like these is not well-defined (should they open in-window? in the main window? many people will disagree with either).

Whitelist the help page by editing Mediawiki:Whitelist. This will no longer be necessary when the Encyclopedia is public.

[edit] Link to the box

The articles are loaded using the mediawiki option action=render, which spits pure html with no kind of wrapper. There is a small php script that wraps them properly and adds style, located at http://sabrpedia.org/helpers.popup.php. Here is an example of a URL:

http://sabrpedia.org/helpers/popup.php?title=Help:Short_narrative_popup

Note that spaces are converted to underlines. You link to the box using a parser function that generates a floatbox link:

{{#sabr-lightbox-iframe:
  http://sabrpedia.org/helpers/popup.php?title=Help:Short_narrative_popup 
  | Writing short narratives 
  | width:650px; height:350px; scrolling:auto; boxLeft:-50%; boxTop:-50%; 
  | What's this? 
}}

Note that this link will not generally contain any line breaks; they are used here for clarification. The options are as follows:

  • URL
  • Caption at the bottom of the popup
  • "rev" options. Seen here are width, height, scrolling style, and placement.
    • Width and height can be pixels or percent. If pixels, should not exceed 950x600. If percent, should not exceed 95%x95%. This is intended to maintain compatibility with both netbooks and large screens.
    • Scrolling should usually be auto
    • The boxLeft and boxTop options used here position the box toward the top left of the screen. They are not required, but are nice for smaller boxes
  • Link text
Personal tools