ChessMarkup-Talk

Summary: Talk page for ChessMarkup.
Maintainer: Petko (original author: Pm)
Users: (View? / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

(Solved) Works only with PHP <= 5.5

With PHP >= 5.6 you will get the warning

preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in 

line 169:

  $board = preg_replace(array('/-+/', '/\\.+/e'),

see also here => https://www.php.net/manual/en/function.preg-replace.php

Bernd Schatz? Mo 27. Apr 00:41:25 CEST 2020

I believe you were using an old version, because version 20160214 was working fine here (PHP 7.0.33). Anyways, it would raise warnings in PHP 7.2 and 7.4 so I've released a new version. Please test and report. --Petko April 27, 2020, at 05:26 AM

Great it works, tested with PHP 5.6 and 7.4 http://sf90geislingen.org/index.php?n=Main.Er%C3%B6ffnungBernd Schatz? May 1

(Solved) Non-square squares

I find that the squares of the chessboard aren’t square (height is greater than width) unless I modify a style, like so (e.g. in config.php):

 $HTMLStylesFmt['chess'] .= "\n  table.chesstable { line-height: 0; }\n";

Said Achmiz December 31, 2017, at 03:54 PM

Added for 20200427, thanks. --Petko April 27, 2020, at 05:26 AM


(Solved) Bug with queenside castling

The recipe prior to version 2006-12-12 didn't recognize the queenside castling (O-O-O) properly. The bug was reported by Bartolin December 12, 2006, at 03:41 AM.

Now fixed, thanks! Pm December 12, 2006, at 07:42 AM

Problem with (:markup:) and (:chessboard:) directives combined

There may be problems if you use both (:markup:) and (:chessboard:) directives -- the chessboards may not display what you expect to see. I guess, that's because everything within (:markup:) environment is interpreted before the "normal" text of wiki pages (which contains your chess moves in PGN format). So: don't use (:chessboard:) directives within (:markup:). For details compare PITS entry 01064.

Bartolin July 08, 2009, at 04:29 PM

Using (:chessboard:) with captions (titles)

I thought it'd be useful to have an option to give a caption (like "white to move") to a position. As noted above that's easy if one uses the Chessboard:{FEN}?t=.gif syntax: It is possible to style the generated image with a style like %rframe% Chessboard:{FEN}&t=.gif | Board after move n .

Using the (:chessboard:) directive I don't see a simple way to provide a caption which remains stuck to the chessboard however this is aligned or styled. Therefore I hacked the script chess.php on my local machine in the following way:

  1. Add the following line to the definition of the function ChessTable($pagename, $args):
    # line 202:
    $caption = $args['caption'];
  2. Add a <caption> tag to the table which defines the chessboard
    # line 230:
    return "<table $tableargs><caption align=bottom>$caption</caption>".Keep(implode('', $out))."</table>";

That makes it possible to use the following syntax:

(:chessboard caption="Board after move x":)

Bartolin


(Solved) Update for PHP 5.5

Hello Pm, I know it's a bit old recipe, but I find it useful. I can change the markup_e for php5.5 by myself, but I am not able to fix the code from preg_replace to preg_replace_callback. If you have a little time, can you fix it? - Thank you.

Frank February 13, 2016, at 22:33 PM

I've updated the recipe, download the zip file and please report if it works. --Petko February 13, 2016, at 05:58 PM

It works well, thank you. --Frank February 14, 2016, at 02:54 AM

Talk page for the ChessMarkup recipe (users?).