Files
schachfreunde-badsteben/site/templates/blockpage.php
T
tfeigel 6fe47279b0 feat: add PGN4Web block support and integrate chess game replay features
Implemented a new PGN4Web block with a PHP snippet for game replay functionality. Updated blueprints with PGN-specific fields, modified layout and blockpage templates, and included necessary JavaScript and assets for interactive chess game rendering. Enhanced memorial page with replayable game content.
2025-07-06 13:36:43 +02:00

31 lines
650 B
PHP

<?php
// FEN in Array umwandeln
function fenToBoard($fen) {
$rows = explode('/', explode(' ', $fen)[0]);
$board = [];
foreach ($rows as $row) {
$boardRow = [];
$chars = str_split($row);
foreach ($chars as $char) {
if (is_numeric($char)) {
for ($i = 0; $i < intval($char); $i++) {
$boardRow[] = '';
}
} else {
$boardRow[] = $char;
}
}
$board[] = $boardRow;
}
return $board;
}?>
<?php
snippet('layout', slots: true) ?>
<?= $page->blocks()->toBlocks() ?>
<?php
endsnippet() ?>