Junge Junge, warum so umständlich?
<ul>, mit CSS formatieren, fertig!
Ich habe meine Sitemap, da sie auch recht umfangreich ist, sogar noch als DB aufgeschrieben. Kleines Beispiel gefällig?
site_id parent_id label url sortierung weight
------- --------- ----- --- ---------- ------
1 0 KinastWebserver Mainhost (http://Kinast) http://Kinast/ 1 bold
2 1 Grund- und Portalfunktionen http://Kinast/ 1 bold
3 2 Startseite http://Kinast/portal.php 1 normal
4 2 Portal http://Kinast/portal.php 2 bold
6 4 Rechtliche Informationen http://Kinast/portal.php?portalwork=copyright 2 normal
7 4 Sitemap http://Kinast/portal.php?portalwork=sitemap 3 normal
5 4 Portal-News http://Kinast/portal.php 1 normal
8 2 News http://Kinast/server/news.php 3 bold
9 8 Portal-News http://Kinast/portal.php 1 normal
10 8 News Übersicht http://Kinast/server/news.php 2 normal
11 8 News Administration http://Kinast/server/news-admin.php 3 normal
12 2 Hilfe http://Kinast/server/help 4 bold
13 12 Einstieg http://Kinast/server/help 1 normal
14 12 Suche http://Kinast/server/help/search.php 2 normal
15 12 Übersicht http://Kinast/server/help/toc.php 3 normal
16 2 weitere Funktionen # 5 bold
17 16 Quelltext von Seiten anzeigen http://Kinast/server/source.php 1 normal
18 16 Logische Relationen von Seiten auf KinastWebserver http://Kinast/server/logical-relations.php 2 normal
19 1 Hauptfunktionen http://Kinast/ 2 bold
20 19 Upload http://Kinast/?upload 1 normal
21 19 Download http://Kinast/?download 2 normal
22 19 FTP-Server ftp://Kinast 3 normal
23 19 LanChat http://Kinast/?lanchat 4 normal
24 19 Kinast Nachrichtenspeicherung http://Kinast/?nachrichten 5 normal
25 19 Kinast Seitenöffner http://Kinast/?siteopener 6 normal
26 19 Kinast Explorer http://Kinast/?explorer 0 normal
27 1 Ressourcen http://Kinast/server/ressources/ 3 bold
28 27 Übersicht http://Kinast/server/ressources/ 1 normal
29 27 SelfHTML http://Kinast/server/ressources/selfhtml/ 2 normal
30 27 PHP-Manual (Deutsch) http://Kinast/server/ressources/php 3 normal
31 27 SelfPHP http://Kinast/server/ressources/selfphp 4 normal
32 0 Homepages (http://homepages.Kinast/) http://homepages.Kinast/ 1 bold
33 32 Order-Übersicht http://homepages.Kinast/ 1 normal
34 32 Homepages-Übersicht http://Kinast/server/homepages.php 2 normal
35 32 Inhalt http://homepages.Kinast/ 3 bold
36 35 kiniplanet http://Kinast/server/homepages.php?site=kiniplanet 1 normal
37 36 Version 1.0 http://homepages.Kinast/andere%20Homepages/Sehr%20Alte%20Homepages/Homepagereali 1 normal
38 36 Version 2.0 http://homepages.Kinast/andere%20Homepages/Sehr%20Alte%20Homepages/kiniplanet 2 normal
39 36 Übergang von Version 2 zu 3 http://homepages.Kinast/andere%20Homepages/andere%20(alte)%20Homepages/Übergangskiniplanet 3 normal
40 36 Version 3.0 http://homepages.Kinast/andere%20Homepages/alte%20Versionen/kiniplanet%20(3er-Version) 4 normal
41 36 Version 4.1 http://Kinast/server/homepages.php?site=kiniplanet 5 normal
42 35 kinast.de.tt http://Kinast/server/homepages.php?site=kinast.de.tt 2 bold
43 42 Version 1.0 http://homepages.Kinast/andere%20Homepages/Sehr%20Alte%20Homepages/kinast.DE.TT%201.0 1 normal
44 42 Version 1.1 http://homepages.Kinast/andere%20Homepages/alte%20Versionen/kinast.DE.TT%20(1.1) 2 normal
......
Dazu noch meine PHP-Funktion:
<?
mysql_connect("localhost");
mysql_select_db("system");
$fquery = mysql_query("SELECT * FROM sitemap WHERE parent_id = 0 ORDER BY sortierung");
function print_sitemap($level_query)
{
print "<ul>";
while($row = mysql_fetch_assoc($level_query)):
print "<li>".print_entry($row["url"], $row["label"], $row["weight"]);
$subquery = mysql_query("SELECT * FROM sitemap WHERE parent_id = ".$row["site_id"]." ORDER BY sortierung");
if(mysql_num_rows($subquery))
print_sitemap($subquery);
print "</li>";
endwhile;
print "</ul>";
}
print_sitemap($fquery);
function print_entry($url, $text, $weight)
{
return "<a href="$url" title="Adresse: $url"".($weight=="bold" ? ' style="font-weight:bold"' : '').">$text</a>";
}
?>
siehtste mal, wie umständlich man es sich machen kann ;-)
Kinast