FlagTooltips

Summary: Show tool tips for flags in page.
Version: 2025-12-05
Prerequisites:
Status:
Maintainer: Anomen
License: LGPL
Categories: Markup
Users: (view / edit)
Discussion: FlagTooltips-Talk

Questions answered by this recipe

It's possible to insert unicode characters which will make up flag of a given country. This recipe shows tooltip with name of country.

Description

Recipe adds tooltip on all flags found in page text.

Installation

Download flagtooltips.zipΔ.

You can also download up-to-date county list https://restcountries.com/v3.1/all?fields=name,cca2,idd. and store it as pub/flagtooltips/countries.json.

In config.php, add the following line:

 include_once("$FarmD/cookbook/flagtooltips.php");

Configuration

 $FlagTooltipsUseLocal = false; // You can force downloading of country list from restcountries.com each time.

Usage

Automatic, just insert flags into the text. You can use https://emojipedia.org/ or similar service.

Example:
Example

To do / some day / maybe

  • load countrylist.json only if any flag is found on the page
  • automatically fetch countrylist and cache it in wiki.d

Change log / Release notes

  • 2025-12-05 - initial release

See also

git repository
https://github.com/anomen-s/pmwiki-recipes/tree/master/FlagTooltips

Contributors

Comments

See discussion at FlagTooltips-Talk

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

Array
(
    [post_max_size] => 64M
    [$_POST keys] => 
    [$_REQUEST keys] => n
    [$_SERVER] => Array
        (
            [CONTEXT_DOCUMENT_ROOT] => /home/pmwiki/public_html
            [CONTEXT_PREFIX] => 
            [DOCUMENT_ROOT] => /home/pmwiki/public_html
            [GATEWAY_INTERFACE] => CGI/1.1
            [HTTPS] => on
            [HTTP_ACCEPT] => */*
            [HTTP_ACCEPT_ENCODING] => gzip, br, zstd, deflate
            [HTTP_HOST] => www.pmwiki.org
            [HTTP_USER_AGENT] => Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
            [HTTP_X_HTTPS] => 1
            [PATH] => /bin:/usr/bin
            [PHP_INI_SCAN_DIR] => /opt/cpanel/ea-php70/root/etc:/opt/cpanel/ea-php70/root/etc/php.d:.
            [QUERY_STRING] => n=Cookbook%2fFlagTooltips
            [REDIRECT_HTTPS] => on
            [REDIRECT_QUERY_STRING] => n=Cookbook%2fFlagTooltips
            [REDIRECT_SCRIPT_URI] => https://www.pmwiki.org/wiki/Cookbook/FlagTooltips
            [REDIRECT_SCRIPT_URL] => /wiki/Cookbook/FlagTooltips
            [REDIRECT_SSL_TLS_SNI] => www.pmwiki.org
            [REDIRECT_STATUS] => 200
            [REDIRECT_UNIQUE_ID] => afNEFoJX3-d87-TSmCztJwAAAFg
            [REDIRECT_URL] => /wiki/Cookbook/FlagTooltips
            [REMOTE_ADDR] => 216.73.216.25
            [REMOTE_PORT] => 21085
            [REQUEST_METHOD] => GET
            [REQUEST_SCHEME] => https
            [REQUEST_URI] => /wiki/Cookbook/FlagTooltips
            [SCRIPT_FILENAME] => /home/pmwiki/public_html/index.php
            [SCRIPT_NAME] => /index.php
            [SCRIPT_URI] => https://www.pmwiki.org/wiki/Cookbook/FlagTooltips
            [SCRIPT_URL] => /wiki/Cookbook/FlagTooltips
            [SERVER_ADDR] => 23.254.203.248
            [SERVER_ADMIN] => webmaster@pmwiki.org
            [SERVER_NAME] => www.pmwiki.org
            [SERVER_PORT] => 443
            [SERVER_PROTOCOL] => HTTP/1.1
            [SERVER_SIGNATURE] => 
            [SERVER_SOFTWARE] => Apache
            [SSL_TLS_SNI] => www.pmwiki.org
            [TZ] => America/Los_Angeles
            [UNIQUE_ID] => afNEFoJX3-d87-TSmCztJwAAAFg
            [PHP_SELF] => /index.php
            [REQUEST_TIME_FLOAT] => 1777550358.7331
            [REQUEST_TIME] => 1777550358
            [argv] => Array
                (
                    [0] => n=Cookbook%2fFlagTooltips
                )

            [argc] => 1
        )

)