6fe47279b0
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.
31 lines
650 B
PHP
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() ?>
|