Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Similar Threads Panel by Matonor


Print Track
Here is the Code for the Panel which shows Similar Threads.
The Code is taken from Matonor's Forum Extensions Panel.
It works for me at 7.02.03.

DEMO (See below the Thread on this Link) :
http://ankurthakur.in/forum/viewthread.php?thread_id=4&pid=4#post_4


[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]
if ((FUSION_SELF == 'viewthread.php'wink && (isset($_GET['thread_id'])))
{
$thread_id = isnum($_GET['thread_id']) ? $_GET['thread_id'] : 0;

if($thread_id){
list($thread_subject) = dbarraynum(dbquery("SELECT thread_subject from ".DB_THREADS." WHERE thread_id=".$thread_id.""wink);

$rel_thread_res = dbquery("
SELECT tt.thread_id, tt.thread_subject, tf.forum_id, tf.forum_name, tf.forum_access, tt.thread_postcount, tt.thread_lastpost
FROM ".DB_THREADS." tt
INNER JOIN ".DB_FORUMS." tf ON tt.forum_id=tf.forum_id
WHERE MATCH (thread_subject) AGAINST ('".$thread_subject."' IN BOOLEAN MODE) AND thread_id != ".$thread_id." AND ".groupaccess('tf.forum_access'wink." ORDER BY tt.thread_lastpost DESC LIMIT 5"wink;

if(dbrows($rel_thread_res)){
opentable("Similar Threads"wink;
echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>\n
<tr>
<th class='forum-caption'>".$locale['global_044']."</th>
<th class='forum-caption'>".$locale['global_048']."</th>
<th class='forum-caption'>".$locale['global_046']."</th>
<th class='forum-caption'>".$locale['global_047']."</th>
</tr>\n";
$i = 0;
while($thread = dbarray($rel_thread_res)){
$i++; $row = $i%2 ? " tbl1" : " tbl2";
echo "
<tr>
<td class='tbl".$row."'><a href='".FUSION_SELF."?thread_id=".$thread['thread_id']."'>".$thread['thread_subject']."</a></td>
<td class='tbl".$row."'>".$thread['forum_name']."</td>
<td class='tbl".$row."'>".$thread['thread_postcount']."</td>
<td class='tbl".$row."'>".showdate("forumdate", $thread['thread_lastpost'])."</td>
</tr>";
}

echo "</table>";
closetable();
}
}

}[/syntaxhighlighter]

35 replies

Cool. Should implement this someone in my forum system.

Thanks.
very nice!
Ahhhh very good, thx Ankur!
Welcome all... :)

Quote

Ankur wrote:

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]
$i++; $row = $i%2 ? "1" : "2";
$i++; $row = $i%2 ? " class='tbl1'" : " class='tbl2'";
[/syntaxhighlighter]


Remove $i++; $row = $i%2 ? " class='tbl1'" : " class='tbl2'";
or place // before $i++; $row = $i%2 ? " class='tbl1'" : " class='tbl2'";
for correct table class view.

Quote

wanabo wrote:

Quote

Ankur wrote:

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]
$i++; $row = $i%2 ? "1" : "2";
$i++; $row = $i%2 ? " class='tbl1'" : " class='tbl2'";
[/syntaxhighlighter]


Remove $i++; $row = $i%2 ? " class='tbl1'" : " class='tbl2'";
or place // before $i++; $row = $i%2 ? " class='tbl1'" : " class='tbl2'";
for correct table class view.


Here is it i always use

Quote

Before => while()
$i = 0;

After => while()
$class = ($i % 2 == 0 ? "tbl1" : "tbl2");

".$class." on all => class=''

and $i++; before the while() end

Quote

Remove $i++; $row = $i%2 ? " class='tbl1'" : " class='tbl2'";
or place // before $i++; $row = $i%2 ? " class='tbl1'" : " class='tbl2'";
for correct table class view


Oops... I forgot that... I just added the code here... Thanks grin

Quote

DrunkeN wrote:

Here is it i always use

Quote

Before => while()
$i = 0;

After => while()
$class = ($i % 2 == 0 ? "tbl1" : "tbl2"wink;

".$class." on all => class=''

and $i++; before the while() end


Same with me bro... wink
@Ankur can you port the code from Matonor to the profile.php file so the users post and threads can be viewed? (stats)

Quote

wanabo wrote:

@Ankur can you port the code from Matonor to the profile.php file so the users post and threads can be viewed? (stats)


Let me see if I can. I will notify you here when completed. B)
Im a little bit confused, how looks the actually code now?
Here is the part from Matonors code for profile stats. This will show the user stats part on profile.php page just install it via panel admin and set on lower panel and display on all pages.
DrunkeN attached the following file:
forum_extension_panel_profile_only.zip [15.84kB / 628 Downloads]
Thanks DrunkeN! I played with this code before but didn't get it working the right way.

Now I played with the code again and succeeded to adapt it to my wishes.

I integrated the panel code in profile.php, restored locale settings and added stats hidden for guests (no need to hammer the database ;))

Modified profile.php is attached. You need the original forum_extension_panel from Matonor in your infusion directory to make use of the different locale files.
Wanabo attached the following file:
profilephp_plus_stats.zip [3.28kB / 613 Downloads]

Quote

DrunkeN wrote:

Here is the part from Matonors code for profile stats. This will show the user stats part on profile.php page just install it via panel admin and set on lower panel and display on all pages.


So quick... Well done Robin... Thanks for that... :)

Quote

wanabo wrote:

Thanks DrunkeN! I played with this code before but didn't get it working the right way.

Now I played with the code again and succeeded to adapt it to my wishes.

I integrated the panel code in profile.php, restored locale settings and added stats hidden for guests (no need to hammer the database ;))

Modified profile.php is attached. You need the original forum_extension_panel from Matonor in your infusion directory to make use of the different locale files.


Thanks for sharing... :)
I think it's post #1 code that is destroying the layout!! Anyway Domi knows about it, sure he will find a solution. :)
Parse error: syntax error, unexpected '}' in /homepages/11/d389978892/htdocs/themes/templates/panels.php(72) : eval()'d code on line 38

Any help?

Quote

XDyNaZTy wrote:

Parse error: syntax error, unexpected '}' in /homepages/11/d389978892/htdocs/themes/templates/panels.php(72) : eval()'d code on line 38

Any help?


remove last } in the code

because its Plus .
Hi

I added a new website to my server and now I'm getting this error when trying to install this same code.

Parse error: syntax error, unexpected T_STRING in /homepages/11/d389978892/htdocs/JuvenileRacing/themes/templates/panels.php(74) : eval()'d code on line 13

Quote

XDyNaZTy wrote:

Hi

I added a new website to my server and now I'm getting this error when trying to install this same code.

Parse error: syntax error, unexpected T_STRING in /homepages/11/d389978892/htdocs/JuvenileRacing/themes/templates/panels.php(74) : eval()'d code on line 13


UPDATED the CODE in Post#1. Please Use that !
Where exactly would i put this, in viewthread.php - Coming up with some errors, could you help - thanks!

Merged on Jan 06 2012 at 12:31:22:
Nethermind, Sorted it - Thanks
author Ankur
forumCode Snippet and functions - 8
replies36 posts
viewed19,788 times
activeLast updated on 6 years ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: wheeler, Craig, Wanabo, NetriX, HaYaLeT, DrunkeN, jikaka, PHPar, XDyNaZTy, spunk, Ankur, Zidane55, Sanhuevon