<{if $can_move}> <{/if}> <{* Initialize rank_counter. *}> <{* rank_counter is used for providing rank labels, and is used in combination with file_counter to determine tile color and tile coordinates. *}> <{counter name=rank_counter assign=rank_count start=$chess_rank_start direction=$chess_rank_direction print=false}> <{* Display warning message if required CSS class is not defined, which indicates that template variable xoops_module_header is missing from the theme. *}>
<{$xoops_theme|string_format:$smarty.const._MD_CHESS_MODHEAD_MISSING}>
<{* outer table provides background coloring *}>
<{* inner table contains chess board *}> <{foreach from=$chess_tiles item=rank}> <{* Initialize file_counter. *}> <{* file_counter is used in combination with rank_counter to determine tile color and tile coordinates. *}> <{counter name=file_counter assign=file_count start=$chess_file_start direction=$chess_file_direction print=false}> <{foreach from=$rank item=piece}> <{if ($rank_count + $file_count) % 2 eq 1}> <{assign var='bgstyle' value='chessWhitetile'}> <{else}> <{assign var='bgstyle' value='chessBlacktile'}> <{/if}> <{* get file-rank coordinates 'fr' of tile (example: 'c5') *}> <{php}> global $xoopsTpl; $xoopsTpl->assign('fr', (chr(ord('a') + $xoopsTpl->get_template_vars('file_count') - 1)) . $xoopsTpl->get_template_vars('rank_count')); <{/php}> <{counter name=file_counter assign=file_count}> <{* increment or decrement *}> <{/foreach}> <{counter name=rank_counter assign=rank_count}> <{* increment or decrement *}> <{/foreach}> <{foreach from=$chess_file_labels item=file_label}> <{/foreach}>
<{$rank_count}>   <{if $piece eq 'x'}> <{* empty tile *}> <{assign var=cmd value='-'|cat:$fr}> <{* example: '-c5' *}> <{elseif $chess_pieces[$piece].color eq $chess_gamedata.fen_active_color}> <{* tile occupied by active player's piece *}> <{assign var=cmd value=$piece|upper|cat:$fr}> <{* example: 'Bc5' *}> <{else}> <{* tile occupied by opponent's piece *}> <{assign var=cmd value='x'|cat:$fr}> <{* example: 'xc5' *}> <{/if}> <{if $can_move}> <{/if}> <{$chess_pieces[$piece].alt}> <{if $can_move}> <{/if}> spacer
   spacer
<{$file_label}>