>>  Site Map >>  Forums >>  Blocks 7x

Forum module - topics in forum:



Blocks 7x - Discussions regarding PHP-Nuke Blocks. 7x



cant get the forum/topic to appear in my last post block..

i am trying to get the forum/topic name in the last 15 posts block , i cant see what is wrong with the code i have tried. can anyone brainstorm it?
nuke 6.x blocks had this all the time and i need to get it working for site im doing......


Code: :
global $prefix, $dbi, $sitename, $user, $cookie, $group_id;
$count = 1;
$amount = 15;
$content = "<A name= \"scrollingCode\"></A>";
$content .="<MARQUEE behavior= \"scroll\" align= \"center\" direction= \"up\" height=\"220\" scrollamount= \"2\" scrolldelay= \"25\" onmouseover='this.stop()' onmouseout='this.start()'>";
$content .="<center> <STYLE=\"text-decoration: none\"><font color=\"#666666\"><b>Last $amount Forum Messages</b></center>";
$result1 = sql_query("SELECT topic_id, topic_last_post_id, topic_title, forum_id FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC LIMIT $amount", $dbi);
$content .= "<br>";
while(list($topic_id, $topic_last_post_id, $topic_title, $forum_id) = sql_fetch_row($result1, $dbi)) {
$result2 = sql_query("SELECT topic_id, poster_id, FROM_UNIXTIME(post_time,'%b %d, %Y at %T') as post_time, forum_id FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'", $dbi);
list($topic_id, $poster_id, $post_time, $forum_id)=sql_fetch_row($result2, $dbi);

$result3 = sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$poster_id'", $dbi);
list($username, $user_id)=sql_fetch_row($result3, $dbi);

$result4 = sql_query("SELECT forum_name FROM".$prefix."_bbforums where forum_id='$forum_id'", $dbi);
list($forumname)=sql_fetch_row($result4, $dbi);

//$topic_title = substr("$topic_title", 0,17);
//$topic_title=parseEmoticons($topic_title);
// Remove the comment below to add the counter
//$content .="<STYLE=\"text-decoration: none\"><font color=\"#666666\"><b>Message: $count<br></b>";

$content .= "<img src=\"modules/Forums/templates/subSilver/images/icon_mini_message.gif\" border=\"0\"alt=\"\"><a href=\"modules.php?name=Forums&amp;file=viewtopic&amp;p=$topic_last_post_id#$topic_last_post_id\"STYLE=\"text-decoration: none\"><b> $topic_title </b></a><br><font color=\"#666666\"><i>Last post by <A HREF=\"forum-userprofile-.html$user_id\"STYLE=\"text-decoration: none\"> $username </a> on $post_time in $forumname</i></font><br><br>";
$count = $count + 1;
}


I thought it would be quite simple as older versions of nuke i used to use had loads of blocks with this in..... Rolling Eyes






If this block is designed for nuke 6.x, then it most probably wont work with 7.x You need to find a block that was developed for 7.x






Sorry you misunderstood.....the code is taken from a 7.x block.
The last posts show up etc but i was trying to get the 'topic title' in the scroll as well...
at the moment it says

"Working at height
Last post by Stuart on Jun 11, 2006 at 09:18:34 in "

what i want it too say is

" Working at height
Last post by Stuart on Jun 11, 2006 at 09:18:34 in ??topic??"

The old 6.x blocks all had this but all the 7.x blocks dont.......

basically i have added this to the working block

$result4 = sql_query("SELECT forum_name FROM".$prefix."_bbforums where forum_id='$forum_id'", $dbi);
list($forumname)=sql_fetch_row($result4, $dbi);

and the $forumname after the on $post_time in the last $content section.

Thanks






Well according to the code you posted the relevant part is commented out, remove that and see if it works.

Code: :
//$topic_title = substr("$topic_title", 0,17);
//$topic_title=parseEmoticons($topic_title);
// Remove the comment below to add the counter
//$content .="<STYLE=\"text-decoration: none\"><font color=\"#666666\"><b>Message: $count<br></b>";


To

Code: :
$topic_title = substr("$topic_title", 0,17);
$topic_title=parseEmoticons($topic_title);
//Remove the comment below to add the counter
$content .="<STYLE=\"text-decoration: none\"><font color=\"#666666\"><b>Message: $count<br></b>";







if its that simple im gunna shoot myself..... Laughing Laughing

i read...'counter' and assumed something different.......ill let you know....thanks






Only the first 2 lines will be relevant, you could leave the 4th line commented.






if i uncomment the two lines as you say, the block just disappears completely, and none of the blocks underneath appear either....

I have the clean code from the original block here without my miserable changes.....please can you have a look again...

Code: :
<?php

if (eregi("block-ForumsScrolltrove.php", $_SERVER['PHP_SELF'])) {
    Header("Location: index.php");
    die();
}

//include_once ('blocks/smileys.php');

global $prefix, $dbi, $sitename, $user, $cookie, $group_id;
$count = 1;
$amount = 15;
$content = "<A name= \"scrollingCode\"></A>";
$content .="<MARQUEE behavior= \"scroll\" align= \"center\" direction= \"up\" height=\"220\" scrollamount= \"2\" scrolldelay= \"25\" onmouseover='this.stop()' onmouseout='this.start()'>";

$result1 = sql_query("SELECT topic_id, topic_last_post_id, topic_title, forum_id FROM ".$prefix."_bbtopics WHERE forum_id=5 ORDER BY topic_last_post_id DESC LIMIT $amount", $dbi);
$content .= "<br>";
while(list($topic_id, $topic_last_post_id, $topic_title) = sql_fetch_row($result1, $dbi)) {
$result2 = sql_query("SELECT topic_id, poster_id, FROM_UNIXTIME(post_time,'%b %d, %Y at %T') as post_time FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'", $dbi);
list($topic_id, $poster_id, $post_time)=sql_fetch_row($result2, $dbi);

$result3 = sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$poster_id'", $dbi);
list($username, $user_id)=sql_fetch_row($result3, $dbi);

//$topic_title = substr("$topic_title", 0,17);
//$topic_title=parseEmoticons($topic_title);
//Remove the comment below to add the counter
//$content .="<STYLE=\"text-decoration: none\"><font color=\"#666666\"><b>Message: $count<br></b>";

$content .= "<img src=\"modules/Forums/templates/subSilver/images/icon_mini_message.gif\" border=\"0\"alt=\"\"><a href=\"modules.php?name=Forums&amp;file=viewtopic&amp;p=$topic_last_post_id#$topic_last_post_id\"STYLE=\"text-decoration: none\"><b> $topic_title </b></a><br><font color=\"#666666\"><i>Last post by <A HREF=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$user_id\"STYLE=\"text-decoration: none\"> $username </a> on $post_time</i></font><br><br>";
$count = $count + 1;
}
?>







I've just re-read your initial posts, you say you want the topic title, the block shows the topic title fine on the block code you just posted.

Here it is tested on this site.



So, now what I'm thinking is that you want replies to forum topics to show their title, I dont think this is possible.






http://www.worldofrtm.com/index.php

the block on the right....

last post by 'username' in 'forum title' on 'date'

this is what i want.....cant get the froum title....

sorry for the confusion....






Kind of what that block is doing that Dar posted using your code.... Confused Rolling Eyes

The latest poster is listed - it mentions when and in what thread.....






its not the 'thread' , i know thats already there...its the forum title.

So on the link i gave above it had the tread title, the poster, when posted and the forum title....

This is what i specifically need as the forums im working on have many topics that may be the same in each so it will be a necessity to have the forum name in the last posted blocks






I found 1 for you.

http://phpnuke-uk.net/downloads/block-Forums_secure.zip






thnaks but this is for 6.5 and i have tried to adapt one like it for 7.x but couldnt work it out...being a complete muppet....

Is their anyway some nice person could quickly adapt it.

i have tried and get the 'last 20 posts' line then the 'php nke pwered site' but no posts from the database.....grrrrrrrrrrrr






heres the code ive changed from the block, ive commented out the 'auth' parts to see if that was stopping the posts but nothing

Code: :
<?php

/************************************************************************/
/* Forums Block for phpBB 2.0.0 port to PHP Nuke 6.5b6+                 */
/* ====================================================                 */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi (fbc@mandrakesoft.com)         */
/* http://phpnuke.org                     */
/*                           */
/* Version 1, modified by Sébastien Vaast                               */
/* http://membres.lycos.fr/projectpluto/                                */
/*                                                                      */
/* Updated by Tom Nitzschner 22/06/2002 to add the scrolling text       */
/*                                                                      */
/* Updated by Paul Laudanski 14 Jan 2003                                */
/* NukeCops.com  |  ComputerCops.biz               */
/*                                               */
/* Last Edited - 14 Jan 2003                        */
/*                                               */
/* This Block shows the last 10 topics where a message was posted,   */
/* along with the username of the last poster and the day and time   */
/* of the post.                        */
/* It will also show smileys in the topic titles thanks to the      */
/* smileys.php file found in Leo Tan Block Forums version      */
/* (http://www.cybercomp.d2g.com).               */
/*                           */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

if (eregi("block-Forums.php", $PHP_SELF)) {
    Header("Location: index.php");
    die();
}

include_once ('blocks/smileys.php');

global $prefix, $dbi, $sitename, $user, $cookie, $group_id;
$count = 1;


$content = "<A name= \"scrollingCode\"></A>";
$content .="<MARQUEE behavior= \"scroll\" align= \"center\" direction= \"up\" height=\"220\" scrollamount= \"2\" scrolldelay= \"20\" onmouseover='this.stop()' onmouseout='this.start()'>";
$content .="<center> <STYLE=\"text-decoration: none\"><font color=\"#666666\"><b>Last 20 Forum Messages</b></center>";



$result1 = sql_query("SELECT topic_id, topic_last_post_id, topic_title, forum_name, forum_id FROM ".$prefix."_bbtopics, ".$prefix."_bbforums where forum_id=forum_id ORDER BY t.topic_last_post_id DESC LIMIT 20", $dbi);
$content .= "<br>";


while(list($topic_id, $topic_last_post_id, $topic_title, $forum_name, $forum_id) = sql_fetch_row($result1, $dbi)) {

   $result2 = sql_query("SELECT topic_id, poster_id, FROM_UNIXTIME(post_time,'%b %d, %Y at %T') as post_time FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'", $dbi);


   list($topic_id, $poster_id, $post_time)=sql_fetch_row($result2, $dbi);
   
   $result3 = sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$poster_id'", $dbi);
   list($username, $user_id)=sql_fetch_row($result3, $dbi);



   $topic_title=parseEmoticons($topic_title);
   // Remove the comment below to add the counter
   //$content .="<STYLE=\"text-decoration: none\"><font color=\"#666666\"><b>Message: $count<br></b>";

       // $sql = "SELECT auth_view
       //     FROM ".$prefix."_bbauth_access
        //    WHERE forum_id = '$forum_id'  and
       //           group_id = '$group_id'  and
       //           auth_view = 1 or
       //           auth_mod  = 1";
       // if( ($result5 = sql_query("SELECT auth_view FROM ".$prefix."_bbauth_access WHERE forum_id = '$forum_id' and group_id = '$group_id' and ( auth_view = 1 or auth_mod = 1 )", $dbi)) )
       // {
          $content .= "<img src=\"modules/Forums/templates/subSilver/images/icon_mini_message.gif\" border=\"0\" alt=\"\"><a href=\"modules.php?name=Forums&amp;file=viewtopic&amp;p=$topic_last_post_id#$topic_last_post_id\"STYLE=\"text-decoration: none\"><b> $topic_title </b></a><br><font color=\"#666666\"><i>Last post by <A HREF=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$user_id\"STYLE=\"text-decoration: none\"> $username </a> in <a href=\"modules.php?name=Forums&amp;file=viewforum&amp;f=$forum_id\">$forum_name</a> on $post_time</i></font><br><br>";
       $count = $count + 1;
       // }

}


$content .= "<br><center>[ <a href=\"modules.php?name=Forums\"STYLE=\"text-decoration: none\">$sitename ]</center>";


?>







i think it must be the line

$result1 = sql_query("SELECT topic_id, topic_last_post_id, topic_title, forum_name, forum_id FROM ".$prefix."_bbtopics, ".$prefix."_bbforums where forum_id=forum_id ORDER BY t.topic_last_post_id DESC LIMIT 20", $dbi);

thats confusing it, selecting where forum_id=forumid
how do you say from table1_forumid=table2_forumid




Attention! You are currently viewing sitemap page!
We strongly suggest to look at original content

Search from web

Select page

Valid HTML 4.01 Valid CSS