Visa källkod

Nedanstående filer finns i denna katalog. Klicka på en fil för att visa dess innehåll.

bth-cards/

  1. .buildpath
  2. .project
  3. CCard.php
  4. CCardHand.php
  5. CDeck.php
  6. argyle.jpg
  7. card.php
  8. common.php
  9. deck.php
  10. grunge.jpg
  11. hand.php
  12. index.php
  13. sessDest.php
  14. sessions.php
  15. sessions_mroos.php
  16. source.php
  17. template.php
  18. tiles.jpg

Stäng "card.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;
?>