Skip to content

Instantly share code, notes, and snippets.

@tml
Forked from DreadKnight/Ancient Beast Bestiary
Created March 15, 2012 03:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tml/2041653 to your computer and use it in GitHub Desktop.
Save tml/2041653 to your computer and use it in GitHub Desktop.
creatures displayed in table based levels and sins
<?php $page_title = "Ancient Beast - Bestiary";
include("../header.php");
include("../global.php");
?>
<script type="text/javascript" src="<?php echo $WorkingDir; ?>utils/tinybox.js"></script>
<?php
echo "$start_div<div style='text-align:center; position:absolute;'>";
$pdo = new PDO(...);
$q = $pdo->query("SELECT * FROM ab_creatures ORDER BY sin, lvl");
$rows = $q->fetchAll();
foreach(array_chunk($rows, 7) as $chunk) {
foreach($chunk as $row) {
if ($row['lvl'] == $x) echo "<div style=\"background:url('" . $WorkingDir . "creatures/" . $row["id"] . "/avatar.jpg'); background-size: 100%; display: inline-block;\" onclick=\"TINY.box.show({url:'details.php',post:'id=" . $row['id'] . "',width:880,height:650,topsplit:2,close:true});\"><a href=\"#id=" . $row['id'] . "\" class=\"lighten\"><img class=\"img lighten\" src=\"frame.png\"></a></div>";
else echo "<div style=\"display: inline-block;\"><img class=\"img lighten\" src=\"frame.png\"></a></div>";
}
$i++;
echo "<br>";
}
echo "</div><div style='height:915px;'></div><center>";
//TODO: rename folders from "creature" directory from id to creature names
echo "</center>$end_div" . $the_end; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment