Exemplo n.º 1
0
        color: #666666;
      }
    </style>
  </head>
  <body>

    <p>This is a simple Tic-Tac-Toe game using Javelin and PHP.</p>
    <p>Click a square to make the first move.</p>
<?php 
require_once '../../support/php/JavelinHelper.php';
$table = array();
$table[] = '<tr>';
$table[] = JavelinHelper::renderTag('td', 'Your move.', array('sigil' => 'tic-tac-status', 'class' => 'status', 'colspan' => '3'));
for ($y = 0; $y < 3; $y++) {
    $table[] = '<tr>';
    for ($x = 0; $x < 3; $x++) {
        $table[] = JavelinHelper::renderTag('td', '', array('class' => 'tictac', 'meta' => array('pos' => $y * 3 + $x), 'sigil' => 'tic-tac-cell', 'mustcapture' => true));
    }
    $table[] = '</tr>';
}
echo JavelinHelper::renderTag('table', implode("\n", $table), array('sigil' => 'tic-tac-board'));
JavelinHelper::initBehavior('tic-tac-toe');
?>
  </body>
  <script src="../../pkg/javelin.dev.js" type="text/javascript"></script>
  <script src="tic-tac-toe.js" type="text/javascript"></script>
<?php 
echo JavelinHelper::renderHTMLFooter();
?>
</html>
Exemplo n.º 2
0
<?php

require_once '../../support/php/JavelinHelper.php';
$list = file_get_contents('animals.txt');
$list = explode("\n", trim($list));
$response = array();
foreach ($list as $id => $animal) {
    $response[] = array(ucfirst($animal), 'http://www.google.com/search?q=' . $animal, $id);
}
echo JavelinHelper::renderAjaxResponse($response);
Exemplo n.º 3
0
 protected static function getInstance()
 {
     if (empty(self::$instance)) {
         self::$instance = new JavelinHelper();
     }
     return self::$instance;
 }