TestPageDirectives

Summary: Tool for easy testing of your skin under various directives
Version: 20160702
Prerequisites: PmWiki 2.2.76 (for checkbox labels)
Status: stable
Maintainer: Petko
License: Public Domain
Categories: Skins, CSS, Layout
Users: (view? / edit)

Questions answered by this recipe

I am working on a new PmWiki skin. How can I test it under various combinations of the directives (:noheader:), (:nofooter:), (:noleft:), (:noaction:), (:notitle:) without having to edit my test pages a number of times?

Description

Form with checkboxes for easy switching on/off for skin elements.

Installation

1. On your test wiki, create a test page like SkinTest-Compact with various markups and styles you need to test. On that example page, the form near the top of the page allows you to switch on and off certain elements from the skin, like the header.

Here is the wiki code of the form:

(:input form action={*$PageUrl} method=get:)\
(:input hidden skin {$Skin}:)(:input default request=1:)\
(:input checkbox no[] Header label="noheader":) \
(:input checkbox no[] Footer label="nofooter":) \
(:input checkbox no[] Action label="noaction":) \
(:input checkbox no[] Title label="notitle":) \
(:input checkbox no[] Left label="noleft":) \
(:input checkbox no[] Right label="noright":) \
(:input checkbox no[] Search label="nosearch":) \
(:input submit value="Test skin":)
(:input end:)

You can copy it to your own page, and/or adapt it for your needs.

2. If your page is [[Main.SkinTest]], create a text file pmwiki/local/Main.SkinTest.php with this content:

<?php
$FmtPV['$Skin'] = '$GLOBALS["Skin"]';
if (count(@$_GET['no'])) {
  foreach ($_GET['no'] as $d) {
    $d = stripmagic($d);
    if (preg_match('/^[A-Z][a-zA-Z]+$/', $d)) SetTmplDisplay("Page{$d}Fmt",0);
  }
}

Configuration

Usage

Check or uncheck the checkboxes then press "Test skin". The page will reappear as if it contained the checked directives. If your skin is designed to respect these directives, eg. (:noleft:), the related skin elements should be hidden eg. the sidebar.

Demo: the recipe is enabled at SkinTest-Compact, feel free to test it (for skins that are already enabled on pmwiki.org).

Notes

Change log / Release notes

  • 20160702 Initial release.

See also

PmWiki /
PageDirectives  Directives to specify page titles, descriptions, keywords, and display
Skins  Change the look and feel of part or all of PmWiki
SkinTemplates  Skin templates (.tmpl files)
Skins /
SkinGuidelines  A set of tips for skin design and packaging skins for distribution (Stable)

Contributors

Recipe written and maintained by Petko

Comments

See discussion at TestPageDirectives-Talk?

User notes? : If you use, used or reviewed "TestPageDirectives", you can add your name. These statistics appear in the Skins listings and will help newcomers browsing through the wiki.