|
Similar Threads Panel by Matonor
|
| Stewart-G0LGS |
Posted on 06-01-2012 13:16
|

Member

Posts: 77
Joined: 28/11/2010
|
Nice - works well.
After I figured out that to use I need to put it into a New Panel.
Stewart G0LGS
I DO NOT response to PM's regarding any posts on this Forum !
|
| |
|
|
| HaYaLeT |
Posted on 17-02-2012 09:33
|

Senior Member

Posts: 276
Joined: 31/10/2008
|
Good work! Can you write for news? or how to changes code (for similar news)..
|
| |
|
|
| Ankur |
Posted on 17-02-2012 15:43
|

Admin

Posts: 1291
Joined: 02/11/2010
|
HaYaLeT wrote:
Good work! Can you write for news? or how to changes code (for similar news)..
Here you go for Similar News 
if ((FUSION_SELF == 'news.php') && isset($_GET['readmore']) && isNum($_GET['readmore']))
{
list($news_subject) = dbarraynum(dbquery("SELECT news_subject from ".DB_NEWS." WHERE news_id=".$_GET['readmore']));
$rel_news_res = dbquery("SELECT news_id, news_subject FROM ".DB_NEWS." WHERE MATCH (news_subject) AGAINST ('".$news_subject."' IN BOOLEAN MODE) AND news_id != ".$_GET['readmore']." ORDER BY news_datestamp DESC LIMIT 5");
if(dbrows($rel_news_res))
{
opentable("Similar News");
echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>\n<tr>\n<th class='forum-caption'>News</th>\n</tr>\n";
while($news = dbarray($rel_news_res))
{
echo "<tr>\n<td class='tbl'><a href='".BASEDIR."news.php?readmore=".$news['news_id']."'>".$news['news_subject']."</a></td>\n</tr>";
}
echo "</table>";
closetable();
}
}
Edited by Ankur on 18-02-2012 10:11
|
| |
|
|
| HaYaLeT |
Posted on 17-02-2012 15:56
|

Senior Member

Posts: 276
Joined: 31/10/2008
|
Thanks for reply but do not show panel or content..And what is this:
WHERE news_id=24
AND news_id != 24
i don't understand it..
|
| |
|
|
| Ankur |
Posted on 18-02-2012 10:12
|

Admin

Posts: 1291
Joined: 02/11/2010
|
HaYaLeT wrote:
Thanks for reply but do not show panel or content..And what is this:
WHERE news_id=24
AND news_id != 24
i don't understand it..
Oops... My bad... Sorry... I putted that 24 ID as a Test for checking the panel working.
Code updated now. You may test it...
|
| |
|
|
| HaYaLeT |
Posted on 18-02-2012 12:32
|

Senior Member

Posts: 276
Joined: 31/10/2008
|
That's..You are great..Working fine shared on >
Edited by HaYaLeT on 18-02-2012 12:37
|
| |
|
|
| Wanabo |
Posted on 19-02-2012 15:15
|

Senior Member

Posts: 357
Joined: 06/02/2006
|
@Ankur, there is a bug in your code with formatting the tbl1 and tbl2
You give $row the value tbl1 or tbl2 and then process it like <td class='tbl".$row."'>
That will output an invalid class! <td class='tbltbl1'> or <td class='tbltbl2'>
It should be <td class='tbl1'> or <td class='tbl2'>
Quick fix:
Change $i++; $row = $i%2 ? " tbl1" : " tbl2"; to $i++; $row = $i%2 ? "1" : "2";
$i = 0;
while($thread = dbarray($rel_thread_res)){
$i++; $row = $i%2 ? "1" : "2";
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>";
}
Edited by Wanabo on 19-02-2012 15:23
|
| |
|
|
| Ankur |
Posted on 20-02-2012 10:43
|

Admin

Posts: 1291
Joined: 02/11/2010
|
Wanabo wrote:
@Ankur, there is a bug in your code with formatting the tbl1 and tbl2
You give $row the value tbl1 or tbl2 and then process it like <td class='tbl".$row."'>
That will output an invalid class! <td class='tbltbl1'> or <td class='tbltbl2'>
It should be <td class='tbl1'> or <td class='tbl2'>
Quick fix:
Change $i++; $row = $i%2 ? " tbl1" : " tbl2"; to $i++; $row = $i%2 ? "1" : "2";
Actually I removed the whole $row and made it simple... me Lazzyy 
However, Thanks for pointing and for the code
|
| |
|
|
| Wanabo |
Posted on 20-02-2012 12:13
|

Senior Member

Posts: 357
Joined: 06/02/2006
|
Well the errors are still here on this site! Note the double single quotes which produces errors, <td class='tbl class='tbl1''>
<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>
<tr>
<th class='forum-caption'>Thread</th>
<th class='forum-caption'>Forum</th>
<th class='forum-caption'>Replies</th>
<th class='forum-caption'>Last Post</th>
</tr>
<tr>
<td class='tbl class='tbl1''><a href='viewthread.php?thread_id=30364'>Panel Error</a></td>
<td class='tbl class='tbl1''>v7.02.xx Testing and reporting</td>
<td class='tbl class='tbl1''>2</td>
<td class='tbl class='tbl1''>16-02-2012 11:03</td>
</tr>
<tr>
<td class='tbl class='tbl2''><a href='viewthread.php?thread_id=27649'>RSS Parser Panel</a></td>
<td class='tbl class='tbl2''>Official releases [Infusions]</td>
<td class='tbl class='tbl2''>34</td>
<td class='tbl class='tbl2''>14-02-2012 06:13</td>
</tr>
<tr>
<td class='tbl class='tbl1''><a href='viewthread.php?thread_id=30050'>Facebook Connect Panel</a></td>
<td class='tbl class='tbl1''>Official releases [Infusions]</td>
<td class='tbl class='tbl1''>63</td>
<td class='tbl class='tbl1''>14-02-2012 06:11</td>
</tr>
<tr>
<td class='tbl class='tbl2''><a href='viewthread.php?thread_id=27986'>Tags System Panel</a></td>
<td class='tbl class='tbl2''>Official releases [Infusions]</td>
<td class='tbl class='tbl2''>32</td>
<td class='tbl class='tbl2''>14-02-2012 06:10</td>
</tr>
<tr>
<td class='tbl class='tbl1''><a href='viewthread.php?thread_id=30343'>Welcome Panel mod</a></td>
<td class='tbl class='tbl1''>Panels and Infusions</td>
<td class='tbl class='tbl1''>10</td>
<td class='tbl class='tbl1''>10-02-2012 20:25</td>
</tr></table></td>
</tr>
</table>
|
| |
|
|
| Zidane55 |
Posted on 23-10-2012 17:16
|

Member

Posts: 93
Joined: 20/07/2011
|
Hey Ankur thanks for this! I was wondering if it is possible to get the similar threads only for some forum_id?
e.g. Threads thats is similar from only forum_id 3 and 4? and not from forum_id 5 and 6.
you understand?  |
| |
|
|
| jikaka |
Posted on 24-10-2012 11:33
|

Admin

Posts: 743
Joined: 28/01/2010
|
why I do not show?
|
| |
|
|
| Zidane55 |
Posted on 24-10-2012 11:53
|

Member

Posts: 93
Joined: 20/07/2011
|
What? Was it possible? |
| |
|
|
| jikaka |
Posted on 24-10-2012 11:55
|

Admin

Posts: 743
Joined: 28/01/2010
|
Zidane55, I have not wrote to you!
I put the code into the panel, save it to the front panel,
but in the end I do not see the panel as in the news and forum
why?
|
| |
|
|
| Zidane55 |
Posted on 24-10-2012 12:00
|

Member

Posts: 93
Joined: 20/07/2011
|
Put the code in the end og viewthread.php and news.php just before <? In the bottom of the file. I have done that  |
| |
|
|
| jikaka |
Posted on 24-10-2012 12:08
|

Admin

Posts: 743
Joined: 28/01/2010
|
hm, as soon as I add, the pages are not available, says "Server Error"
|
| |
|