Author Topic: Custom Recent Topics Block  (Read 539 times)

Offline Ilkharnos

  • Jr. Member
  • **
  • Posts: 115
  • Gender: Male
    • Kara Miğfer Hanı
Custom Recent Topics Block
« on: December 11, 2017, 02:01:23 AM »

I have got a custom php code which uses SSI.php functions in order to build a "Recent Topics" list. You choose which topics will be shown by adding their topic ID within an array. I use this code in a "custom php" block in Simple Portal. After I build a recent topics list, when I click on one of the topics, I am redirected to its beginning (first post).

Since I use it as a "Recent Topics" block, I would like to be redirected to its last post when I click on a topic in this list.

For the same reason, I would like to see a new message icon (...language/new.gif) when there is an unread post in these topics, just like the one in the topic list of a board.

I don't know which of the codes should be modified (SSI.php or the custom php code below?) I am not a coder and I have got almost zero knowledge about php or html codes. So, I would be grateful for any help.

NOTE: Simple Portal's own "Recent Posts/Topics" option is of no use to me.

Thank you in advance.

Code: [Select]
global $smcFunc;

// Array with all the IDs of topics separated by comas
$topics = array(topicID1, topicID2,...);

$shown = array();

foreach($topics as $id) {
    $request = $smcFunc['db_query']('', '
SELECT t.id_first_msg
FROM {db_prefix}topics as t
WHERE t.id_topic = {int:topic}',
'topic' => $id,
    while ($row = $smcFunc['db_fetch_row']($request))
        $shown[] = $row[0];


Offline Ilkharnos

  • Jr. Member
  • **
  • Posts: 115
  • Gender: Male
    • Kara Miğfer Hanı
Re: Custom Recent Topics Block
« Reply #1 on: December 12, 2017, 09:33:29 AM »
I have found another solution for what I was trying to accomplish. Problem is solved.