Applet-Talk

Summary: Talk page for Applet.
Maintainer: Dfaure
Users: +1 (View / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Comments

Clickable preview image + align left/center/right

appletimage.phpΔ is a modification of the above recipe that displays a still image (e.g. a screenshot) instead of the actual applet. Only a mouse click will turn that placeholder image into the actual applet.

Advantages

  1. The page loads quicker with the image instead of the applet
  2. A screenshot can represent the applet in the print version of the wiki page.

Requirements for this feature: JavaScript-enabled and DHTML-capable browser (tested with Firefox 3 and IE 7).

This modification adds fouroptional parameters:

clickimg="IMAGEFILE"
where IMAGEFILE is the filename of an image (gif, png, jpeg,...) to be uploaded. If this parameter is missing the recipe behaves almost (see below) like the original version of applet.php.
clickalt="TEXT"
where TEXT is the alternative text for the preview image (:<img alt="TEXT" src=...>)
clickcaption="TEXT"
where TEXT is a caption that goes beneath the applet or image.
clickalign="POSITION"
where POSITION is either "left", "center", or "right" for the display of the applet/image on the page.
Beware: clickimg, clickalt, clickalign, and clickalign cannot be forwarded to the applet any more as in <param name="clickimg"...>. (The same holds for id and name, see below)

There are three optional configuration variables for config.php:

$AppletImageUploadLinkFmt
Title of an image upload link that appears beneath the running applet for as long as no image has been uploaded yet. (only when clickimg is set, and not for ?action=print e.g.) - default: "'-Upload a preview image for this applet-'"
$AppletImageClickMeHintFmt
Text that appears beneath the still image to indicate that a mouse click will start the applet. (only when clickimg is set, and not for ?action=print e.g.) - default: "Click on the image to start the applet."
$AppletImageDefaultAlign
Default alignment on the page if no parameter clickalign is specified in the applet markup. The applet or the image will be aligned by using <div align="..."> - possible values here: "left", "center", "right" - default: none (default alignment in browser)

Other minor modifications in appletimage.php:

  • allow for absolute URLs in the codebase ("http://...")
  • treat id and name as properties of the <object> tag instead of forwarding them to the applet (needed for scripting applets)

I'm not that confident a programmer that I would dare to replace the original version of applet.php. But maybe others could look into merging those versions. I marked all modifications in the php source.

Enjoy! Frank.

Talk page for the Applet recipe (users).