<HTML>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=euc-jp">
<HEAD>
<TITLE>PHP LINKS</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#006666" LINK="#660066" VLINK="#990099" ALINK="#FF00FF">
<TABLE WIDTH="84%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#550055" HEIGHT="56">
<TR>
<TD ALIGN="CENTER">
<FONT COLOR="#FFFFFF" FACE="Times New Roman, Times, serif"><B><FONT SIZE="+2">
<FONT COLOR="#CC66FF">PHP Links</FONT></FONT></B></FONT>
</TD>
</TR>
</TABLE>
<BR>
<BR>
-カテゴリクイックリンク-<BR>
<?
mysql_connect("localhost","root","");
mysql_select_db("test_link");
Show_Itself_And_Call_Children(0,-1, "folder");
Show_Itself_And_Call_Children(0,-1, "all");
function Show_Itself_And_Call_Children($number, $indent, $mode){
//表示
if ($number != 0){
$result = mysql_query("select * from links where number=$number");
$row = mysql_fetch_assoc($result);
foreach($row as $key => $value){
$$key = $value;
}
//インデント
$indent_width = $indent*40;
$indent_print = "<img src=\"images/space.gif\" width=\"$indent_width\" height=\"1\">";
if($type == "folder") { //フォルダの場合の表示
if($mode == "folder") { //フォルダのみ表示モードの場合
print $indent_print;
print "<a href=\"#$number\">$title</a>";
print ": $comment<br>\n";
}
else{ //全表示モードの場合
print "<BR>";
print "<BR>";
print $indent_print;
print "<a name=\"$number\">";
print "<img src=\"images/bar2.jpg\" width=\"600\" height=\"9\"><br>";
print $indent_print;
print "<img src=\"images/rec.jpg\" width=\"15\" height=\"15\">";
print "<font size=+2 color=\"#CC00CC\"><i>$title</i></font>";
print ": $comment</a>";
print "<BR>\n";
}
}
else { //リンクの場合の表示
print $indent_print;
print "<img src=\"images/circle.jpg\" width=\"10\" height=\"10\">";
print "<a href=\"$link\">$title</a>";
if(!empty($banner)) print "<img src=\"$banner\" width=\"30\" height=\"15\">";
print ": $comment<br>\n";
}
}
//子供呼び出し
if($mode == "folder") $query = "select * from links where parent_number=$number && type='folder'";
else $query = "select * from links where parent_number=$number order by type DESC";
$result = mysql_query($query);
while ($row=mysql_fetch_assoc($result)) Show_Itself_And_Call_Children($row[number], $indent+1, $mode);
}
?>
</BODY>
</HTML>