There are options available (described below) for changing the size and color of the resulting chessboard image.
Of course, displaying a chessboard in its starting position isn't all that useful by itself, so this recipe also recognizes Portable Game Notation as wiki markup that internally modifies the chessboard. Thus, an author can write something like
1. e4 c5 Sicilian opening 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 g6 Dragon variation
and PmWiki treats each of the above PGN entries as moves in a virtual game. The
Following multiple analysis lines
The PGN markup can also be used to investigate alternate lines of play. For example, starting with the Dragon variation listed above, we can write
The move 2...e6 leads to more defensive variations of the Sicilian opening. The Taimanov variation goes 2...e6 3.d4 cxd4 4.Nxd4 Nc6 which leads to:
Notice how the
Of course, this means that starting from a completely new board position is as simple as writing a new first move:
It's also possible to display a chessboard in a specific position using Forsyth-Edwards Notation. For example, to display a chessboard after white's third move in the classic Ruy Lopez:
cookbook/chess.php - PGN and
Once installed, add the following line to a local customization file to enable the chess PGN markups:
Although the PGN markups understand things such as castling (
width=[width] width of the chessboard in pixels (default 240) height=[height] height of the chessboard (default same as width) class=[class] table class (default "chesstable") align=[center] table alignment ("left", "right", or "center") style=[style] table CSS styles
In addition, there's also a
The board at right shows the initial move for a variety of queen's pawn openings, including the Queen's Gambit.
The tile images for chess pieces are stored in a simple image file, custom piece images can be easily created and configured into the chessboard.php script. The image files distributed with this recipe was built from tile images created by David Benbennick and made available through the Wikimedia commons through a freely-redistributable license.
See discussion at ChessMarkup-Talk