Thomas 0 Report post Posted June 5, 2004 hyhy! endlcih mal wieder zeit zu basteln abi "vorbei" also denne mal zum wesendlichen also ich habe mit hilfe von silaz last_forum_post.php den block so modifiziert, dass jedesmal wenn in ein topic gepostet wird dieses topic nach ganz oben rutscht und dann auch jeweils der user angezeigt wird der den letzzten post geschreiben hat. das ganze sieht so aus! <? /* +-------------------------------------------------------------------------- | MkPortal | ======================================== | | +-------------------------------------------------------------------------- */ $content = ""; $content.="<tr><td id=\"tdblock\" align=\"center\">Titel</td> <td id=\"tdblock\" align=\"center\">Von</td> <td id=\"tdblock\" align=\"center\">Am</td> <td id=\"tdblock\" align=\"center\">Ant.</td> <td id=\"tdblock\" align=\"center\">Hits</td> </tr>"; setlocale(LC_TIME, $this->lang['setlocale']); $limit = 5; $taglio = 17; $DB->query("SELECT id, read_perms FROM ibf_forums"); while( $f = $DB->fetch_row() ) { if ( $std->check_perms($f['read_perms']) != TRUE ) { $bad[] = $f['id']; } else { $good[] = $f['id']; } } if ( count($bad) > 0 ) { $qe = " AND forum_id NOT IN(".implode(',', $bad ).") "; } $DB->query("SELECT tid, title, posts, last_poster_id as member_id, last_poster_name as member_name, last_post as post_date, views FROM ibf_topics WHERE state!='closed' AND approved=1 AND (moved_to IS NULL or moved_to='') $qe ORDER BY last_post DESC LIMIT 0,$limit"); while ( $post = $DB->fetch_row() ) { $post['title'] = strip_tags($post['title']); $post['title'] = str_replace( "!" , "!" , $post['title'] ); $post['title'] = str_replace( """, "\"", $post['title'] ); if (strlen($post['title']) > $taglio) { $post['title'] = substr( $post['title'],0,($taglio - 3) ) . "..."; $post['title'] = preg_replace( '/&(#(\d+;?)?)?(\.\.\.)?$/', '...',$post['title'] ); } $post['date'] = strftime ("%d.%m.%Y | %H:%M", $post['post_date']); //$post['date'] = date("d-m-y H:i" , $post['post_date'] + $std->get_time_offset() ); $tid = $post['tid']; $title = $post['title']; $mid = $post['member_id']; $mname = $post['member_name']; $date = $post['date']; $ant = $post['posts']; $hits = $post['views']; $content .= "<tr> <td id='tdglobal'><a class=\"uno\" href='{$ibforums->base_url}showtopic=$tid'>$title</a></td> <td id='tdglobal' align=\"center\"><a class=\"uno\" href='{$ibforums->base_url}showuser=$mid'>$mname</a></td> <td id='tdglobal' align=\"center\">$date</td> <td id='tdglobal' align=\"center\">$ant</td> <td id='tdglobal' align=\"center\">$hits</td> </tr>"; } ?> nun möchte ich aber noch eine anzeige des forum reinbringen in dem der thread liegt! wie mach ich das? kann mir da einer weiterhelfen? vielen dank schon mal im vorraus! Share this post Link to post
Deutscher 0 Report post Posted December 12, 2004 (edited) Thank you Thomas for this great script! I have a question.. When i click on the poster name, i want to show "the last post" instead of showing member info page. How can i do this? Which part of the script shoul be changed? (I'm sorry for my language. Actually i'm not a German but i love Germany and Germans. That's why my user name is always "Deutscher" ) Vielen dank! Regards.. Edited December 12, 2004 by Deutscher Share this post Link to post
Stefan 0 Report post Posted December 12, 2004 Kannst es mitteles eines JOIN machen. SELECT f.name, f.id, t.tid, t.title, t.posts, t.last_poster_id as member_id, t.last_poster_name as member_name, t.last_post as post_date, t.views FROM ibf_topics t LEFT JOIN ibf_forums f ON (t.forum_id = f.id) WHERE t.state!='closed' AND t.approved=1 AND (t.moved_to IS NULL or t.moved_to='') $qe ORDER BY last_post DESC LIMIT 0 ,$limit Oder auch so SELECT f.name, f.id, t.tid, t.title, t.posts, t.last_poster_id as member_id, t.last_poster_name as member_name, t.last_post as post_date, t.views FROM ibf_topics t, ibf_forums f WHERE t.forum_id = f.id AND t.state!='closed' AND t.approved=1 AND (t.moved_to IS NULL or t.moved_to='') $qe ORDER BY last_post DESC LIMIT 0 ,$limit Natürlich noch die entsprechenden Spalten angeben, die du haben willst. Hab jetzt mal nur den Forumname und die ID angegeben. Share this post Link to post
Deutscher 0 Report post Posted December 12, 2004 (edited) Vielen dank für Hilfe! I understand that : This is the original code of Thomas : $DB->query("SELECT tid, title, posts, last_poster_id as member_id, last_poster_name as member_name, last_post as post_date, views FROM ibf_topics WHERE state!='closed' AND approved=1 AND (moved_to IS NULL or moved_to='') $qe ORDER BY last_post DESC LIMIT 0,$limit"); and will be replaced with this? (your code) $DB->query("SELECT f.name, f.id, t.tid, t.title, t.posts, t.last_poster_id as member_id, t.last_poster_name as member_name, t.last_post as post_date, t.views FROM ibf_topics t LEFT JOIN ibf_forums f ON (t.forum_id = f.id) WHERE t.state!='closed' AND t.approved=1 AND (t.moved_to IS NULL or t.moved_to='') $qe ORDER BY last_post DESC LIMIT 0,$limit"); Am i right? So, i tried liked this but could not work :( Edited December 12, 2004 by Deutscher Share this post Link to post
Stefan 0 Report post Posted December 12, 2004 Sorry, but Thomas only asked, how he can get information about the forum where the topics are located. So I gave him the correct SQL statement and I think he will implement it in his mod in the near future. There have to be some minor changes in the output, so that these information will be shown in the portal. Share this post Link to post
Deutscher 0 Report post Posted December 12, 2004 @Stefan Ok.. Now, all of us are waiting for Thomas Vielen Dank! Share this post Link to post