TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 561
  • Total: 561

custom "Recent Topics from Board X, Y, Z only" php block

Started by iowamf, November 04, 2005, 09:47:16 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

iowamf

Can you post the tweaks you made ?

BTW, you are right the original was done for an older ver of SMF/TP. 

Quote from: jakemelon on February 11, 2007, 06:10:43 PM
Alright this works like a charm! I am using 1.1.1 but I think original snipped I copied from the forum must have been older. I was able to make some tweaks to this now and it is perfect!

thank you!
jake


jakemelon

global $context, $scripturl, $settings, $txt;
$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

$result=ssi_recentTopics_Include(12,array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48),'return');

foreach($result as $my){
  echo "$bullet";
  echo '<span class="smalltext">'.$my['link'];

  // is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
        echo ' <a href="', $scripturl, '?topic=', $my['topic'], '.from', $my['new_from'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
echo ' in ', $my['board']['link'];
echo ' by ', $my['poster']['link'];
echo ' posted ', $my['time'];
echo '<br />';

}
echo '</span>';


This seems to only display last 5 posts, any way to increase this to 10 posts? I thought the $result=ssi_recentTopics_Include(12,array   controlled how many posts should show up but that is not it.

Any thoughts?

jake

jacortina

Quote from: jakemelon on February 27, 2007, 02:55:56 PM
This seems to only display last 5 posts, any way to increase this to 10 posts? I thought the $result=ssi_recentTopics_Include(12,array   controlled how many posts should show up but that is not it.

Any thoughts?

Yes. The number is actually a maximum. The query uses an algorithm that only looks at the last (35 * num_request) posts. So if you only have 5 topics in the boar(s) that you haven't excluded which have had posts added in the last 420 (35*12) posts, then that's all you'll get.

tick

Quote from: jakemelon on February 27, 2007, 02:55:56 PM
global $context, $scripturl, $settings, $txt;
$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

$result=ssi_recentTopics_Include(12,array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48),'return');

foreach($result as $my){
  echo "$bullet";
  echo '<span class="smalltext">'.$my['link'];

  // is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
        echo ' <a href="', $scripturl, '?topic=', $my['topic'], '.from', $my['new_from'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
echo ' in ', $my['board']['link'];
echo ' by ', $my['poster']['link'];
echo ' posted ', $my['time'];
echo '<br />';

}
echo '</span>';


This seems to only display last 5 posts, any way to increase this to 10 posts? I thought the $result=ssi_recentTopics_Include(12,array   controlled how many posts should show up but that is not it.

Any thoughts?

jake

Ok I am new so i have to ask this question.  Do I put this code in a php box on the front page to make this work?  And how do I make it show the last 30 post

tick

ok I did add this to the frontpage block and when I enabled it I got an error .  How do I make this work.

jakemelon

Hi,

Make sure you change these numbers to correspond to your own forums. I have 48 different ones so I listed the ones I wanted to show in my box. If you pasted all of them and you don't have 48 of them then it will probably not work.

array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48),'return');


tick

so you put the number of boards.  Say i have 8 board i would put 1,2,3,4,5,6,7,8






edit  this is the error I get.      Parse error: syntax error, unexpected T_VARIABLE in /home2/ibewfrie/public_html/Sources/Load.php(1747) : eval()'d code(35) : eval()'d code on line 1

denis

Hi,

I have 6 instances of the SMF/TP duo working. I would like the 1st SMF/TP duo to be able to fetch recent post from the 2nd, 3rd, 4th, 5th and 6th instances. Is this possible? IF so what would be the best approach?

Thanks

Denis.



IchBin

Are they on the same server? I don't think you could if not, but I'm not sure.

denis

Yes they are on the same server and under the same domain.

This website is proudly hosted on Crocweb Cloud Website Hosting.