Recent Changes - Search:




Summary: add guibuttons to any textarea edit box
Version: 2007-04-23
Prerequisites: PmWiki 2
Status: stable
Categories: Editing Layout Forms

Questions answered by this recipe

How can I add guibuttons like there are for the edit window to a multiline text input box?


This recipe adds a guibuttons markup, which adds GUI edit buttons to any textarea input box

Install by downloading guibuttons.zipΔ, unzipping to pub/guibuttons, and moving guibuttons.php into the cookbook folder. Add to config.php:


The pub/guibuttons/folder contains a selection of guibutton images, from DWin's MyGuiEdit.zipΔ, and a selection of smiley images, used for adding smileys. The location of the gui images could be changed, as could be the guibuttons used, by editing the guibuttons.php file.

To add guibuttons to a textarea input control put markup (:guibuttons:) above the input control, and add id=text to the control, for instance

(:input textarea id=text name=comment cols=60 rows=6:)

The id=text is used by the javascript to put the markup into the text box. The javascript used is PmWiki's default script for guiedit buttons.

The smileys placed with smiley buttons are displayed with an included selection of smiley markup definitions from WikiSmileys. If you want the full range of shortcut smileys you want to install WikiSmileys.


If one wants to have the gui buttons offered by this recipe in the general edit form, then one could do simply

1. disable PmWiki guibuttons in config.php with

$EnableGUIButtons = 0; //or comment out the line

2. change in Site.EditForm or whatever edit form is used for general editing the markup

(:e_guibuttons:) to (:guibuttons:)

Release Notes

  • 2007-04-23: Changed variable name to GuiButtonsDirFmt to avoid conflict with edit GuiButtons.
  • 2007-04-10: Fixed smiley markup, changed from general to gif image specific markups.
  • 2007-04-09: Added smiley markup to display {smiley}s (from WikiSmileys). Fixed directory path.
  • 2007-04-08: initial release

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".


Not a big deal, but button images are sourced from $FarmPubDirUrl which isn't a standard PmWiki variable-at least it isn't in my version 2.2.0-beta37. SteP April 19, 2007, at 07:43 AM

I've just combined this recipe with the GuiEdit recipe. Download ao.guiedit.phpΔ and MyGuiEdit2.zipΔ, and see GuiEdit#guiedit_guibtns_combo for more details. overtones99 June 29, 2008, at 06:54 PM

Migration to PHP 5.5

Markup('guibuttons', 'directives','/\\(:guibuttons:\\)/e',
"Keep(FmtPageName(GUIButtonsMarkup(\$pagename), \$pagename))");

if(function_exists('Markup_e')) { # new format, no /e
Markup_e('guibuttons', 'directives','/\\(:guibuttons:\\)/',
"Keep(FmtPageName(GUIButtonsMarkup(\$pagename), \$m[1)))");
else {
Markup('guibuttons', 'directives','/\\(:guibuttons:\\)/e',
"Keep(FmtPageName(GUIButtonsMarkup(\$pagename), \$pagename))");

See Also


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

Edit - History - Print - Recent Changes - Search
Page last modified on March 04, 2017, at 06:37 AM