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>
<div> <p>The typeahead above uses a <tt>TypeaheadPreloadedSource</tt>, which preloads every possible value with one request. This usually works best if you have no more than around 1,000 results. If you have more, you may want to use <tt>TypeaheadOnDemandSource</tt>, which makes multiple requests as the user types. This allows the user to efficiently search a much larger result space.</p> <p>This typeahead loads suggestions on the fly.</p> </div> <div> <strong>On Demand Typeahead</strong> <div id="ondemandtypeahead" style="position: relative; width: 200px"> <input type="text" class="jx-typeahead" /> </div> </div> <?php require_once '../../support/php/JavelinHelper.php'; JavelinHelper::initBehavior('typeahead-examples', array('preloadedURI' => 'preloaded-source.php', 'preloadedHardpoint' => 'preloadedtypeahead', 'ondemandURI' => 'ondemand-source.php', 'ondemandHardpoint' => 'ondemandtypeahead')); ?> </body> <script src="../../pkg/javelin.dev.js" type="text/javascript"></script> <script src="../../pkg/typeahead.dev.js" type="text/javascript"></script> <script src="typeahead-examples.js" type="text/javascript"></script> <?php echo JavelinHelper::renderHTMLFooter(); ?> </html>