|
Similar Threads Panel by Matonor
|
| Ankur |
Posted on 02-08-2011 06:17
|

Admin

Posts: 1291
Joined: 02/11/2010
|
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
if ((FUSION_SELF == 'viewthread.php') && (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.""));
$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')." ORDER BY tt.thread_lastpost DESC LIMIT 5");
if(dbrows($rel_thread_res)){
opentable("Similar Threads");
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();
}
}
}
Edited by Ankur on 06-01-2012 05:13
|
| |
|
|
| NetriX |
Posted on 02-08-2011 06:44
|

Admin

Posts: 385
Joined: 22/09/2007
|
Cool. Should implement this someone in my forum system.
Thanks.
|
| |
|
|
| jikaka |
Posted on 02-08-2011 06:54
|

Admin

Posts: 743
Joined: 28/01/2010
|
very nice!
|
| |
|
|
| spunk |
Posted on 08-11-2011 15:20
|

Member

Posts: 64
Joined: 01/11/2010
|
Ahhhh very good, thx Ankur! |
| |
|
|
| Ankur |
Posted on 08-11-2011 15:36
|

Admin

Posts: 1291
Joined: 02/11/2010
|
Welcome all...
|
| |
|
|
| Wanabo |
Posted on 08-11-2011 17:17
|

Senior Member

Posts: 350
Joined: 06/02/2006
|
Ankur wrote:
$i++; $row = $i%2 ? "1" : "2";
$i++; $row = $i%2 ? " class='tbl1'" : " class='tbl2'";
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.
|
| |
|
|
| DrunkeN |
Posted on 09-11-2011 01:37
|

Admin

Posts: 125
Joined: 04/06/2009
|
wanabo wrote:
Ankur wrote:
$i++; $row = $i%2 ? "1" : "2";
$i++; $row = $i%2 ? " class='tbl1'" : " class='tbl2'";
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
Before => while()
$i = 0;
After => while()
$class = ($i % 2 == 0 ? "tbl1" : "tbl2" ;
".$class." on all => class= ''
and $i++; before the while() end
|
| |
|
|
| Ankur |
Posted on 09-11-2011 12:01
|

Admin

Posts: 1291
Joined: 02/11/2010
|
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 :D
DrunkeN wrote:
Here is it i always use
Before => while()
$i = 0;
After => while()
$class = ($i % 2 == 0 ? "tbl1" : "tbl2");
".$class." on all => class=''
and $i++; before the while() end
Same with me bro... ;)
|
| |
|
|
| Wanabo |
Posted on 09-11-2011 20:44
|

Senior Member

Posts: 350
Joined: 06/02/2006
|
@Ankur can you port the code from Matonor to the profile.php file so the users post and threads can be viewed? (stats)
|
| |
|
|
| Ankur |
Posted on 10-11-2011 08:34
|

Admin

Posts: 1291
Joined: 02/11/2010
|
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.
|
| |
|
|
| spunk |
Posted on 10-11-2011 12:39
|

Member

Posts: 64
Joined: 01/11/2010
|
Im a little bit confused, how looks the actually code now? |
| |
|
|
| DrunkeN |
Posted on 10-11-2011 19:52
|

Admin

Posts: 125
Joined: 04/06/2009
|
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:
|
| |
|
|
| Wanabo |
Posted on 10-11-2011 21:18
|

Senior Member

Posts: 350
Joined: 06/02/2006
|
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:
|
| |
|
|
| Ankur |
Posted on 11-11-2011 12:13
|

Admin

Posts: 1291
Joined: 02/11/2010
|
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... 
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...
|
| |
|
|
| Craig |
Posted on 11-11-2011 12:31
|

Fusioneer

Posts: 3980
Joined: 27/09/2005
|
I think it's post #1 code that is destroying the layout!! Anyway Domi knows about it, sure he will find a solution.
|
| |
|
|
| XDyNaZTy |
Posted on 01-01-2012 17:40
|

Junior Member

Posts: 37
Joined: 27/05/2010
|
Parse error: syntax error, unexpected '}' in /homepages/11/d389978892/htdocs/themes/templates/panels.php(72) : eval()'d code on line 38
Any help? |
| |
|
|
| PHPar |
Posted on 02-01-2012 10:42
|

Admin

Posts: 88
Joined: 03/03/2010
|
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 . |
| |
|
|
| XDyNaZTy |
Posted on 06-01-2012 01:30
|

Junior Member

Posts: 37
Joined: 27/05/2010
|
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 |
| |
|
|
| Ankur |
Posted on 06-01-2012 05:14
|

Admin

Posts: 1291
Joined: 02/11/2010
|
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 !
|
| |
|
|
| wheeler |
Posted on 06-01-2012 12:27
|

Member

Posts: 91
Joined: 07/07/2004
|
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
Edited by wheeler on 06-01-2012 12:31
Michael Wheeler
|
| |
|