Location: PHPKode > scripts > PHP Chess classes > php-chess-classes/example.php
<html>
  <head>
    <title>PHPChess \l/ |</title>
    <style type="text/css">
      body {
        font: 90% Verdana, Arial;
      }

      h1 {
        margin: 0px;
        font: 200% Tahoma, Arial;
      }

      hr {
        width: 80%;
        margin: 0px;
        text-align: left;
        color: #aaa;
      }

      .credits {
        font-size: 60%;
        font-weight: normal;
      }

    </style>
  </head>

  <body>
    <h1>PHPChess <span class="credits">by Carlos Reche</span></h1>
    <hr />

    <p>
      This script is a demonstration of how to use PHPClass. Read the comments for a
      detailed explanation.
    </p>

    <p style="margin-bottom: 50px;">
      The best browsers to play are Mozilla Firefox and Opera, because they response better
      to these game's javascript functions and they support the Unicode value of chess pieces
      (in case you did not download the GIF or PNG images). But don't worry if you're using
      Internet Explorer, this game should run with no problem in this browser, too.<br />
      Enjoy!
    </p>
<?php



//Loads PHPChess library to this script
require_once "class.phpchess.php";


// Starts $Chess object
$Chess = new PHPChess();


// Sets the SMTP server to send emails
$Chess->setSMTP("smtpserver.host.com");


// Tries to use image files to represent the pieces
if (is_dir("images/"))
{
    $Chess->setImageDir("images/");
}


// Sets if should diplay the board coordinates
$Chess->showCoordinates(true);


// Sets the size of board squares
$Chess->squareSize(40);


// Shows a message to the user (usually last moves or error messages)
echo '<p style="text-align: center;">' . $Chess->message(true) . '</p>';


// Shows the chess board
$Chess->board();


// Shows the HTML form
$Chess->form();



?>

  </body>
</html>
Return current item: PHP Chess classes