Danke abermals, aber ich meine programmatisch (PHP)
Mein derzeitiger Stand:
<html>
<head>
<title>Möp-Karte</title>
<style type="text/css">
body {
background: #000;
color: #fff;
}
</style>
</head>
<body>
<div align="center">
<h1>Möp-Karte</h1>
<?php
class map {
function calc($from, $to) {
$numeric=array($from => '', $to => '');
$letters=array($from => '', $to => '');
$splitter = str_split($from);
$splitter2 = str_split($to);
foreach($splitter as $fv){
if(is_numeric($fv)) {
$numeric[$from]=$numeric[$from].$fv;
}else{
$letters[$from]=$letters[$from].$fv;
}
}
foreach($splitter2 as $tv){
if(is_numeric($tv)) {
$numeric[$to]=$numeric[$to].$tv;
}else{
$letters[$to]=$letters[$to].$tv;
}
}
// var_dump($numeric);
// var_dump($letters);
//$this->view($numeric,$letters);
//$this->view($from,$to);
return array($numeric, $letters);
}
function x_axis($m=null, $n=null) {
$data = array(
"1" => "",
"2" => "",
"3" => "",
"4" => "",
"5" => "",
"6" => "",
"7" => "",
"8" => ""
);
if($m != null && $n != null) {
$all = $this->calc($m, $n);
//var_dump($all);
foreach($all[0] as $signed) {
if(stristr($m,$signed)) {
$data[$signed] = $m;
}
if(stristr($n,$signed)) {
$data[$signed] = $n;
}
}
}
return $data;
}
function y_axis($m=null, $n=null) {
$data = array(
"A" => "",
"B" => "",
"C" => "",
"D" => "",
"E" => "",
"F" => "",
"G" => "",
"H" => ""
);
if($m != null && $n != null) {
$all = $this->calc($m, $n);
//var_dump($all);
foreach($all[1] as $signed) {
if(stristr($m,$signed)) {
$data[$signed] = $m;
}
if(stristr($n,$signed)) {
$data[$signed] = $n;
}
}
}
return $data;
}
function view($from=null, $to=null) {
$datax = $this->x_axis($from, $to);
$datay = $this->y_axis($from, $to);
//var_dump($datax);
echo "<table style='border: 1px solid #fff; font-size: 40px; margin: 0 auto;' cellspacing='0'>";
foreach($datax as $keyx => $x) {
echo "<tr style='border: 1px solid #fff;'>";
$datax[$keyx]="";
foreach($datay as $keyy => $y) {
if($y == $keyy.$keyx) {
echo "<td style='border: 1px solid red;'>".$keyy.$keyx."</td>";
} else {
echo "<td style='border: 1px solid #fff;'>".$keyy.$keyx."</td>";
}
}
echo "</tr>";
}
echo "</table>";
}
}
$mapClass = new map;
?>
<table>
<form method="POST" action="">
<tr><td>von:</td><td><input type="text" name="from" placeholder="From"></td></tr>
<tr><td>zu:</td><td><input type="text" name="to" placeholder="To"></td></tr>
<tr><td></td><td><input type="submit" value="Berechnen" name="calc"></td></tr>
</form>
</table>
<?php
if(isset($_POST['calc'])) {
$mapClass->view($_POST['from'], $_POST['to']);
}else{
$mapClass->view();
}
?>
</div>
</body>
</html>
[/PHP]
Das sieht so aus und makiert derzeit Start und Ziel.