Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Navigation
Latest Addons
AD Gallery 50
SyntaxHighlighte... 51
Newsletters v4.03 112
Facebook Like Box 125
Newsletters v4.02 57
Metro 161
Facebook Connect 169
Shoutbox Panel 126
Redactor for PHP... 106
MI Floating Side... 108
Facebook Login/R... 154
Avatar Studio v2.03 179
Relationship Sta... 98
Sexual Orientati... 116
Fisherman 143
Popular Addons
iTheme2 5800
Arise 5788
User Control v1.23 4618
Event Calendar 4050
Photowidget panel 3887
Radio-Theme red2... 3355
Highslide Gallery 3313
CSS/JavaScript D... 3229
Facebook Connect... 2985
Dynamic Menu 2892
Slideshow Lightb... 2721
L-AMANT 2659
Enigma 2634
2Dark 2606
Black 2576
View Thread
Official Home of PHP-Fusion » General Addon and Modification Support » Code Snippet and functions
Who is here? 1 guest(s)
 Print Thread
Similar Threads Panel by Matonor
Stewart-G0LGS
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 !
 
www.g0lgs.co.uk
HaYaLeT
Good work! Can you write for news? or how to changes code (for similar news)..
 
http://www.hayaletsevgili.com
Ankur
HaYaLeT wrote:

Good work! Can you write for news? or how to changes code (for similar news)..


Here you go for Similar News www.php-fusion.co.uk/images/smiley/smile.gif

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
ankurthakur.co.cc/images/freelancer.png
 
http://ankurthakur.in/
HaYaLeT
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..
 
http://www.hayaletsevgili.com
Ankur
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... Wink
ankurthakur.co.cc/images/freelancer.png
 
http://ankurthakur.in/
HaYaLeT
That's..You are great..Working fine Celebrate shared on >
Edited by HaYaLeT on 18-02-2012 12:37
 
http://www.hayaletsevgili.com
Wanabo
@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
KPN Gebruikers Groep, my largest pHp-Fusion site about an ISP.
pHp-Fusion.Org, tutorials to enhance php-fusion.
pHp-Fusion.Asia & pHp-Fusion.Fr & pHp-Fusion.Cn are available for a localized support site. Send PB for info.
 
http://ziggo.gebruikers.eu
Ankur
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 Pfft

However, Thanks for pointing and for the code Smile
ankurthakur.co.cc/images/freelancer.png
 
http://ankurthakur.in/
Wanabo
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>

KPN Gebruikers Groep, my largest pHp-Fusion site about an ISP.
pHp-Fusion.Org, tutorials to enhance php-fusion.
pHp-Fusion.Asia & pHp-Fusion.Fr & pHp-Fusion.Cn are available for a localized support site. Send PB for info.
 
http://ziggo.gebruikers.eu
Zidane55
Hey Ankur Smile 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? Smile
 
jikaka
why I do not show?Frown
www.rusfusion.ru - russian nss
 
www.rusfusion.ru
Zidane55
What? Was it possible?
 
jikaka
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?
www.rusfusion.ru - russian nss
 
www.rusfusion.ru
Zidane55
Put the code in the end og viewthread.php and news.php just before <? In the bottom of the file. I have done that Smile
 
jikaka
hm, as soon as I add, the pages are not available, says "Server Error"
www.rusfusion.ru - russian nss
 
www.rusfusion.ru
Jump to Forum:
Similar Threads
Thread Forum Replies Last Post
Birthday panel Panels and Infusions 1 21-05-2013 21:12
Link panel to another subdomain Content Administration 3 19-05-2013 08:50
Stop Forum Spam Panel Official releases [Panels] 14 12-05-2013 19:51
edit login side panel. Content Administration 3 10-05-2013 18:45
Theme Control Panel Content Administration 2 08-05-2013 13:19
Official Home of PHP-Fusion uses cookies. Some may already have been set. Read more about our Cookies here.
Please click the button I Consent Cookies to hide this bar and accept our cookies. If you continue to use the site with no action taken, we'll assume that you consent our cookies anyway.
Cookiebar Panel byVenue