Показать сообщение отдельно
Старый 29.01.2004, 00:35
silgd вне форума Посмотреть профиль Отправить личное сообщение для silgd Посетить домашнюю страницу silgd Найти все сообщения от silgd
  № 3  
silgd
 
Аватар для silgd

Регистрация: Aug 2002
Адрес: Israel
Сообщений: 35
Отправить сообщение для silgd с помощью ICQ
MySQL Table:
------------------
parent
poster
title
body
postedDate
postedTime
postid (auto_increment)
forumId
------------------

Tree function:
PHP код:
# TREE
function get_tree($parent_id 0$prefix "") {
    global 
$out;
    
$query "SELECT * FROM madforum_posts WHERE forumId = '$_GET[forumId]' AND parent = '$parent_id' ORDER BY postid DESC, postedDate DESC";
    
$result mysql_query($query);
    while (
$row mysql_fetch_array($result)) {
    
$out .=  "<tr class=\"msgtd\"><td>".$prefix."<img src=\"img/bulet.gif\"> <a href=javascript:showComm("$row['postid'] .")>".$row['title']."</a> <font class=\"poster\">".$row['poster']."</font></td><td align=left><font class=\"poster\">".$row['postedDate']." ".$row['postedTime']."</font></td></tr><tr><td id=CommTD_"$row['postid'] ." style=display:none;padding-right:15px; colspan=2 class=\"msgtd\"><img src=../images/dot.gif width=1 height=10><br><hr size=1 width=100% color=#cccccc>".preg_replace('/\n/i''<br />'$row['body'])."<hr size=1 width=100% color=#cccccc><img src=../images/dot.gif width=1 height=10><br></td></tr>";
    
get_tree($row['postid'], $prefix."<img src=../images/dot.gif width=15 height=1>");
    }
return 
$out;

Forum Index Page:
PHP код:
# INCLUDE REQUIRED FUNCTIONS
include("lib/db_fns.php");
include(
"lib/header.php");
include(
"lib/footer.php");
include(
"lib/tree_fns.php");

# MySQL QUERY
$ResultForumName mysql_query("SELECT forumTitle FROM madforum_forums WHERE forumId = '$_GET[forumId]'");
$RowForumName mysql_fetch_array($ResultForumName);

# MAIN PROGRAMM CALCULATION
header_frm("My Forum: ".$RowForumName[forumTitle]);
echo 
"<b>".$RowForumName[forumTitle]."</b><p>";
echo 
"<table cellpadding=\"1\" cellspacing=\"0\" width=\"100%\" align=\"right\" border=\"0\">";
echo 
get_tree();
echo 
"</table>";
footer(); 
Дальше выходит вот так:

1
|
+ - 2
| |
| + - 3
| + - 4
|
+ - 5
....
__________________
EVIL-HORSE


Последний раз редактировалось silgd; 29.01.2004 в 00:41.