Visa källkod
Nedanstående filer finns i denna katalog. Klicka på en fil för att visa dess innehåll.
- .buildpath
- .project
- CCard.php
- CCardHand.php
- CDeck.php
- argyle.jpg
- card.php
- common.php
- deck.php
- grunge.jpg
- hand.php
- index.php
- sessDest.php
- sessions.php
- sessions_mroos.php
- source.php
- template.php
- tiles.jpg
Stäng "index.php"
<?php
// ===============================================================
// Contents: Kortgrejer.
// Author: Staffan Lindsgård
// ===============================================================
$pagetitle = "Kortelikort!";
$customhead = "";
require_once "common.php";
echo $page_top;
// ===============================================================
// Inkluderar externa PHP-filer.
require_once "CCard.php";
// ===============================================================
// Inställningar för felsökning.
error_reporting(-1);
$debug = true;
$debug = (empty($_POST['debug']) ? $debug : $_POST['debug']);
$debug = ($debug=="true" ? true : false);
$debug_out = "<h2 class='debug'>Debug</h2>\n";
// ===============================================================
// Skriver lite variabler.
$c1 = new CCard('H', 1, 'F');
$c2 = new CCard('S', 13, 'B');
$c3 = new CCard('S', 12, 'F');
$c4 = new CCard('C', 6, 'B');
$c5 = new CCard('D', 9, 'F');
$c6 = new CCard('X', 2, 'F');
$hand = Array($c1, $c2, $c3, $c4, $c5, $c6);
$debug_out .= "<h3>Hand</h3>\n<pre>\n".print_r($hand,true)."</pre>\n";
$html = "<h2>Vilka kort har jag nu?</h2>\n";
// Show as ID
$html .= "<h3>Som ID</h3>\n<p>";
foreach($hand as $card) {
$html .= $card->GetCardAsId() . ", ";
}
$html .= "</p>\n";
// Show as text
$html .= "<h3>Som text</h3>\n<p>";
foreach($hand as $card) {
$html .= $card->GetCardAsText() . ", ";
}
$html .= "</p>\n";
// Show as CSS
$html .= "<h3>Som CSS</h3>\n";
foreach($hand as $card) {
$html .= $card->GetCardAsCSS();
}
$html .= "\n";
// Show as flipped CSS
$html .= "<h3>Som inverterad CSS</h3>\n";
foreach($hand as $card) {
$card->FlipCard();
$html .= $card->GetCardAsCSS();
}
$html .= "\n";
?>
<h1>Då skall vi se på den lilla handen...</h1>
<p>Jaha, där ser man...</p>
<?php echo $html; ?>
<?php echo $debug_out; ?>
<?php
echo $page_bottom;
?>