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

Recent

Welcome to TinyPortal. Please login or sign up.

May 02, 2024, 01:29:24 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,176
  • Total Topics: 21,220
  • Online today: 113
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 80
  • Total: 80

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 1 Guest are viewing this topic.

kai920

Thanks for this thread iowamf.

I'm trying to display recent posts only from board id "2"... but this code does not seem to work: (note I do not have board id "3")

$result=ssi_recentTopics(10,array(7,4,5,8,1,6,10,9),'return');
echo'<center>';
echo '<list>';
foreach($result as $my){
echo '<li>'.$my['link'].'</li>';
}
echo '</list>';
echo'</center>';
echo '<span class="smalltext">SmallText</span>';


Any ideas on what may be wrong?  All that is displayed in the box is "SmallText".

iowamf

it looks ok - do other ssi_ calls work?

i'd open up your ssi_ call to not exclude so many boards - make sure you get something  :-\

throw in a print_r for debug to get a bunch of info to look at (see below).

$result=ssi_recentTopics(10,array(59,2),'return');
foreach($result as $my){
echo '<span class="smalltext">'.$my['link'].'<br>';
}
echo "<hr>";
echo "<pre>";
print_r ($result);
echo "</pre>";
echo '<hr>';

criminalmind

#12
Has anybody posted the "ssi_recentTopics_reverse" function or similar?
Or is there another way to display (in a block) the last X posts from (not excluding) a specified range of boards?

iowamf

Quote from: criminalmind on February 26, 2006, 10:30:10 AM
Has anybody posted the "ssi_recentTopics_reverse" function or similar?
Or is there another way to display (in a block) the last X posts from (not excluding) a specified range of boards?

Edit SSI.php, copy the entire function ssi_recentTopics and create a new one - but call it ssi_recentTopicsINC (or whatever you want).

Follow what is in this thread over at simplemachines where an awesome guru provided some nuggets of wisdom.

NOTE - this worked fine on SMF 1.1 RC1 (has not been tested on SMF 1.1 RC2 yet).

criminalmind

Quote from: iowamf on February 26, 2006, 04:42:01 PM

Follow what is in this thread over at simplemachines where an awesome guru provided some nuggets of wisdom.


This thread doesnt work. Please provide the code (if u still have it) without refering to any links!

IchBin

If you want the last 10 topics from any board just take out the array part.

$result=ssi_recentTopics(10, 'return');
echo'<center>';
echo '<ul>';
foreach($result as $my){
echo '<li>'.$my['link'].'</li>';
}
echo '</ul>';
echo'</center>';

iowamf

I wanted to link as the credit is due to a support guru - not me ... plus, the code is more SMF related than TP related (another reason why I linked back to it - and posted there in the 1st place).

Quote from: criminalmind on February 26, 2006, 06:15:24 PM
Quote from: iowamf on February 26, 2006, 04:42:01 PM

Follow what is in this thread over at simplemachines where an awesome guru provided some nuggets of wisdom.

This thread doesnt work. Please provide the code (if u still have it) without refering to any links!

yo' criminalmind, watch your bangs (!) - it makes your post sound like a demand/shout  :coolsmiley:

for the link and search impaired, the repost from:
  http://www.simplemachines.org/community/index.php?topic=51987
is below:

note - I edited Oldiesmann post to add the INC to the end of the new function call in the 1st replace ... I hope it's not taboo to copy and paste from the SMF boards to this board?  If so - please delete this post.

Quote from: Oldiesmann on October 13, 2005, 01:25:18 AM
SSI.php

Find
function ssi_recentTopics($num_recent = 8, $exclude_boards = null, $output_method = 'echo')

Replace
function ssi_recentTopicsINC($num_recent = 8, $include_boards = null, $output_method = 'echo')

Find
if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
$exclude_boards = array($modSettings['recycle_board']);
else
$exclude_boards = empty($exclude_boards) ? array() : $exclude_boards;


Replace
$include_boards = empty($include_boards) ? array() : $include_boards;

Find
AND b.ID_BOARD = t.ID_BOARD" . (empty($exclude_boards) ? '' : "
AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "


Replace
AND b.ID_BOARD = t.ID_BOARD" . (empty($include_boards) ? '' : "
AND b.ID_BOARD IN (" . implode(', ', $include_boards) . ")") . "
" . ((!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) ? "
AND b.ID_BOARD != '$modSettings[recycle_board]'" : '') . "



rodman


iowamf

Quote from: rodman on March 14, 2006, 05:41:44 AM
Is there a way to get the "new" image displayed?

it is there.

see post#9 code box (it is somewhat hidden by the scroll bars) after the "is this topic new?" comment.

rodman

AWSOME!!!

This has helped me out so much!! TY iowamf and everyone else who helped!!

Is there a way to increase the font by just a tad ....   ;)