[/PHP] [COLOR=crimson]hallo zusammen,
ich möchte den code ändern. leider verstehe ich aber den code nicht so recht. kann mir bitte jemand kurz erläutern was da passiert?
quelle des codes: http://www.zanfi.nl/index1.php?flag=phpmenu[/COLOR]
[PHP]<? require ("setup.php");
$fo = fopen("data.csv","r");
$data = "<link rel=\"stylesheet\" type=\"text/css\" href=\"$csstyle\">\r\n";
$data .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n";
if ($place == ""):
if ($link != ""):
$data .= "<tr><td class=\"celmenu\"><div align=\"left\"><a href=\"http://$link\"";$rec .= $link.",";$c++;
$data .= " target=\"$target\">";$rec .= $target.",";$c++;
$data .= "$item</a></div></td><tr>\r\n"; $rec .= $item."\r\n";
else:
$data .= "<tr><td>";$rec .= ","; $c++;
$data .= "";$rec .= ",";$c++;
$data .= "<strong>$item</strong></div></td><tr>\r\n";$rec .= $item."\r\n";
endif;
endif;
while ($data_r = fgetcsv ($fo, 1000, ",")) {
$num = count ($data_r);
$row++;
for ($c=0; $c < $num; $c++) {
if ($data_r[$c] != ""):
$data .= "<tr><td class=\"celmenu\"><div align=\"left\"><a href=\"http://$data_r[$c]\"";$rec .= $data_r[$c].","; $c++;
$data .= " target=\"$data_r[$c]\">";$rec .= $data_r[$c].",";$c++;
$data .= "$data_r[$c]</a></div></td><tr>\r\n";$rec .= $data_r[$c]."\r\n";
else:
$data .= "<tr><td class=\"celmenu\">";$rec .= ","; $c++;
$data .= "";$rec .= ",";$c++;
$data .= "<strong>$data_r[$c]</strong></div></td><tr>\r\n";$rec .= $data_r[$c]."\r\n";
endif;
if ($data_r[$c] == $place):
if ($link != ""):
$data .= "<tr><td class=\"celmenu\"><div align=\"left\"><a href=\"http://$link\"";$rec .= $link.",";$c++;
$data .= " target=\"$target\">";$rec .= $target.",";$c++;
$data .= "$item</a></div></td><tr>\r\n"; $rec .= $item."\r\n";
else:
$data .= "<tr><td class=\"celmenu\">";$rec .= ","; $c++;
$data .= "";$rec .= ",";$c++;
$data .= "<strong>$item</strong></div></td><tr>\r\n";$rec .= $item."\r\n";
endif;
endif;
}
}
fclose ($fo);
$data .= "</table>";
if ($mymenu_path != ""):
$filename = $mymenu_path."\$filename";
endif;
$fp = fopen($filename,"w");
fwrite($fp, $data);
fclose ($fp);
$fp = fopen("data.csv","w");
fwrite($fp, $rec);
fclose ($fp);
header("location: contrpanel.php");
?>
ich möchte den code ändern. leider verstehe ich aber den code nicht so recht. kann mir bitte jemand kurz erläutern was da passiert?
quelle des codes: http://www.zanfi.nl/index1.php?flag=phpmenu[/COLOR]
[PHP]<? require ("setup.php");
$fo = fopen("data.csv","r");
$data = "<link rel=\"stylesheet\" type=\"text/css\" href=\"$csstyle\">\r\n";
$data .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n";
if ($place == ""):
if ($link != ""):
$data .= "<tr><td class=\"celmenu\"><div align=\"left\"><a href=\"http://$link\"";$rec .= $link.",";$c++;
$data .= " target=\"$target\">";$rec .= $target.",";$c++;
$data .= "$item</a></div></td><tr>\r\n"; $rec .= $item."\r\n";
else:
$data .= "<tr><td>";$rec .= ","; $c++;
$data .= "";$rec .= ",";$c++;
$data .= "<strong>$item</strong></div></td><tr>\r\n";$rec .= $item."\r\n";
endif;
endif;
while ($data_r = fgetcsv ($fo, 1000, ",")) {
$num = count ($data_r);
$row++;
for ($c=0; $c < $num; $c++) {
if ($data_r[$c] != ""):
$data .= "<tr><td class=\"celmenu\"><div align=\"left\"><a href=\"http://$data_r[$c]\"";$rec .= $data_r[$c].","; $c++;
$data .= " target=\"$data_r[$c]\">";$rec .= $data_r[$c].",";$c++;
$data .= "$data_r[$c]</a></div></td><tr>\r\n";$rec .= $data_r[$c]."\r\n";
else:
$data .= "<tr><td class=\"celmenu\">";$rec .= ","; $c++;
$data .= "";$rec .= ",";$c++;
$data .= "<strong>$data_r[$c]</strong></div></td><tr>\r\n";$rec .= $data_r[$c]."\r\n";
endif;
if ($data_r[$c] == $place):
if ($link != ""):
$data .= "<tr><td class=\"celmenu\"><div align=\"left\"><a href=\"http://$link\"";$rec .= $link.",";$c++;
$data .= " target=\"$target\">";$rec .= $target.",";$c++;
$data .= "$item</a></div></td><tr>\r\n"; $rec .= $item."\r\n";
else:
$data .= "<tr><td class=\"celmenu\">";$rec .= ","; $c++;
$data .= "";$rec .= ",";$c++;
$data .= "<strong>$item</strong></div></td><tr>\r\n";$rec .= $item."\r\n";
endif;
endif;
}
}
fclose ($fo);
$data .= "</table>";
if ($mymenu_path != ""):
$filename = $mymenu_path."\$filename";
endif;
$fp = fopen($filename,"w");
fwrite($fp, $data);
fclose ($fp);
$fp = fopen("data.csv","w");
fwrite($fp, $rec);
fclose ($fp);
header("location: contrpanel.php");
?>
Kommentar