Recent Changes - Search:

add Cookbook page

hide

Cookbook


hide

Topics


show

Changed

Visitor's book Site map pmwiki-2.3.32

Messages Replacement

MessagesReplacement version 2024-04-10

Summary: A drop in replacement for the PmWiki (:messages:) directive
Version: 2022-12-02
Prerequisites: PmWiki 2.2.131 (PHP 7.4 compatible)
Status: beta
Maintainer: skiwi
Licence: GPL3#
Users: (view / edit)

Questions answered by this recipe

Can I display selected debugging messages from $MessagesFmt from only one message source.

Description

A drop in replacement for the PmWiki (:messages:) directive. Based on code from PITS:01368.

The global variable $MessagesFmt is written to by PmWiki recipes with debug and similar information. By convention the array has two dimensions, the first identifying the source of the message, and the second the debug message itself.

Differences are:

  • comma or space separated parameters, with wildcards, can be supplied to limit the messages displayed
  • only messages for specified parameters are displayed
  • parameters are case insensitive
  • directive does not have to start at the beginning of a line
  • placed within a HTML section of class=messages
  • groups of messages are separated by a blank line

Installation

  • download messagesreplacement-2022-12-02.php Δ
  • copy to the /cookbook/ directory as messagesreplacement.php
  • add to config.php the line
    include_once ($FarmD/cookbook/messagesreplacement.php);

Usage

Place the directive, as described below, in your PmWiki page.

The recipe provides a page variable {$MessagesReplacementVersion} which contains the current version, and page variable $@MessagesReplacement for a (:if enabled MessagesReplacement:) recipe installation check.

Configuration

(:messages optional,list,of,names :)

  • parameters are optional and case-insensitive.
  • names can include wild cards

config.php settings

You can change the following in config.php. For example

$MessagesReplacementDebug = true; # results may vary
default: false
$MessagesReplacementHeading = true; # shows heading level 3 for each group of messages
default: false

Change log / Release notes

2022-02-02 Separate groups of messages, enable heading 2022-01-22 Initial version

See also

Contributors

Special thanks to Petko

Comments

See discussion at MessagesReplacement-Talk

tahi Page last modified on 2023 Dec 29 16:11

Edit - History - Recent Changes - WikiHelp - Search - (:messages:) -> mailto:?Subject="KiwiWiki: Messages Replacement"&Body="From KiwiWiki: Messages Replacement (https://kiwiwiki [period] co [period] nz/Cookbook/MessagesReplacement) - A drop in replacement for the PmWiki [[PmWiki:PageDirectives#message directive" | email page as link ]]